5

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] http://localhost:8888/?token=7d0bbefd6ff58eddf9a1dbbd3d63e273282311d5b346cbe3
[I 18:24:31.237 NotebookApp]  or http://127.0.0.1:8888/?token=7d0bbefd6ff58eddf9a1dbbd3d63e273282311d5b346cbe3
[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: http://localhost:8888/?token=7d0bbefd6ff58eddf9a1dbbd3d63e273282311d5b346cbe3 or http://127.0.0.1:8888/?token=7d0bbefd6ff58eddf9a1dbbd3d63e273282311d5b346cbe3

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 (http://localhost:8888/?token=7d0bbefd6ff58eddf9a1dbbd3d63e273282311d5b346cbe3 or http://127.0.0.1:8888/?token=7d0bbefd6ff58eddf9a1dbbd3d63e273282311d5b346cbe3), but it is not user-friendly and break normal expected workflow.

N0rbert
  • 99,918
  • Don't you need a connection to home? snap connections firefox? Mint developers seems to dislike snap, did you consider Flatpak alternative? – Pablo Bianchi Jan 31 '22 at 04:30
  • The problem is that, by default, it cant access that path any further than /home/i/; This is snaps not having access to dot folders. I have looked everywhere and there is nothing in english on how to make it possible. There is a LOT of "take a look at this link" but no "answer", which makes me think they don't understand what they are reading either (even on this site). I am using Opera snap and i can get to the same results as you. From what I can understand, if I could get Opera to use the "personal-files" interface, then it should be able to access hidden folders/files(firefox in your case) – WU-TANG Jan 31 '22 at 06:06
  • I have no idea on how to do that... i am no expert with snaps... But if you do know how to do that, I would appreciate if you'd post that process if it turns out to work for an answer for you. I've only barely looked through the jupyter application, but if there is a config file that you could designate that "/home/i/.local/share/jupyter/runtime/nbserver-2252-open.html" to be something like /home/i/LOCAL/x/x/xxxx.... or something without a hidden directory, I'm pretty sure that would work. – WU-TANG Jan 31 '22 at 06:10

2 Answers2

3

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 http://localhost:8888/?token=blahblah 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

3

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.

N0rbert
  • 99,918
WU-TANG
  • 3,071