cliu
cliu

Reputation: 33

Cannot open Jupyter Notebook in Ubuntu system

I am trying to open Jupyter Notebook from Ubuntu terminal, but it fails to start because of permission issues. Specifically, a webpage would open up in the Firefox browser, which displays the error message

The file at /home/<user>/.local/share/jupyter/runtime/nbserver-61219-open.html is not readable.

I have found an similar issue at Cannot open new Jupyter Notebook [Permission Denied], which suggests that I should change the ownership of the folder by typing the command

sudo chown -R <user>:<user> ~/.local/share/jupyter 

However, this did not work for me. I have also tried other suggestions from https://github.com/microsoft/WSL/issues/3608. The commands sudo jupyter-notebook --allow-root or sudo jupyter notebook --allow-root result in errors saying that the commands are not found. I have also tried chmod -R 777 <my directory>, and the same error still occur.

I realize that at runtime, Jupyter Notebook produces a .html file and a .json file in /home/<user>/.local/share/jupyter/runtime/, the directory where the permission error is reported. By running ls -l on this directory during runtime, it seems like I (both the user and the group) do not have execute permission on these two files, but have read and write permissions. Is this the cause to my problem? How can I fix this?

(Additionally, I installed Jupyter Notebook using pip inside the conda base environment, and all the above commands are executed in the same environment)

Specs:

Upvotes: 0

Views: 2843

Answers (2)

Ankush Soni
Ankush Soni

Reputation: 145

Try changing the version of the Jupyter Notebook installed. It worked for me (I am using Ubuntu 22.04 pre release).

Type the following in terminal: pip install notebook==5.6.0

Upvotes: 3

user2529729
user2529729

Reputation: 11

Ubuntu switched Firefox to a snap in 21.10. Snaps can't open files under directories that are hidden in your home directory, like ~/.local.

I have the same issue and am hoping for a solution less drastic than removing the snap and reinstalling Firefox using apt.

Upvotes: 1

Related Questions