How to correctly configure Snap'd Firefox to open local html-file, generated by Jupyter Notebook launcher?

I'm currently running Ubuntu MATE 21.10.
As an experiment (to be ready to Firefox deb → Snap migration) I have removed deb-packaged Firefox from it by

sudo apt-get autopurge firefox

and installed Snap version of Firefox with

snap install firefox
$ snap list firefox
Name Version Rev Tracking Publisher Notes
firefox 96.0.2-1 886 latest/stable mozilla✓ -

Its permissions are default: only "Use any connected joystick" and "Read access to network settings" are disabled.

Also I have installed Jupyter Notebook from official repositories on this system by

sudo apt-get install jupyter-notebook

When I launch Jupyter Notebook using jupyter-notebook from terminal it shows some greeting message:

$ jupyter-notebook
[I 18:24:31.237 NotebookApp] Serving notebooks from local directory: /home/i
[I 18:24:31.237 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 18:24:31.237 NotebookApp]
[I 18:24:31.237 NotebookApp] or
[I 18:24:31.237 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:24:31.295 NotebookApp] To access the notebook, open this file in a browser: file:///home/i/.local/share/jupyter/runtime/nbserver-2252-open.html Or copy and paste one of these URLs: or 

then opens Firefox with error message inside it:

Access to the file was denied

The file at /home/i/.local/share/jupyter/runtime/nbserver-2252-open.html is not readable.

It may have been removed, moved, or file permissions may be preventing access.

From the same machine I can access this file using terminal

$ ls -al /home/i/.local/share/jupyter/runtime/nbserver-2252-open.html
-rw-rw-r-- 1 i i 673 Jan 28 18:24 /home/i/.local/share/jupyter/runtime/nbserver-2252-open.html

or using deb-packaged Epiphany.

I already know that there is a workaround by visiting localhost's URLs ( or ), but it is not user-friendly and break normal expected workflow.

3

2 Answers

Just make a launcher to circumvent the snap restraint.

A simple launcher would look like:

#!/bin/bash
export JUPYTER_DATA_DIR=/home/$USER/Public
export JUPYTER_RUNTIME_DIR=/home/$USER/Public
jupyter-notebook

...or skip the launcher and set the environment variables wherever convenient.

Err, you cant. I tried to look at hidden directories (.local etc) with different browsers and none work. But hang on there is a workaround: see this link.Your browser will/should open with the link automatically.

NB: creating and editing the conf file worked but the cleanup didn't work for me.

Create the configuration file by running the command:

jupyter-notebook --generate-config

Edit the file

~/.jupyter/jupyter_notebook_config.py

and set:

c.NotebookApp.use_redirect_file = False

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like