'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:
Ubuntu version: 21.10
Jupyter Notebook version: 6.4.5
Miniconda version: 4.10.3
Python version: 3.9.5
Web browser: Firefox
Solution 1:[1]
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
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ankush Soni |
| Solution 2 | user2529729 |
