Cannot open new Jupyter Notebook [Permission Denied]
change the ownership of the ~/.local/share/jupyter
directory from root to user.
sudo chown -R user:user ~/.local/share/jupyter
see here: https://github.com/ipython/ipython/issues/8997
The first user
before the colon is your username, the second user
after the colon is your group. If you get chown: [user]: illegal group name
, find your group with groups
, or specify no group with sudo chown user: ~/.local/share/jupyter
.
EDIT: Added -R
option in comments to the answer. You have to change ownership of all files inside this directory (or inside ~/.jupyter/
, wherever it gives you PermissionError) to your user to make it work.
On Ubuntu, 'permission denied' may appear when browser is installed as a 'snap'. I had this problem. I edited config file to open a regular browser and it worked.
How to change the default browser used by the ipython/jupyter notebook in Linux?
Tried everything that was suggested but finally this helped me:
sudo jupyter notebook --allow-root
In my case, it didn't start the browser by itself. So just copy the link from terminal and open it by yourself.
Update: Change folder(.local) permissions by this command:
sudo chmod -R 777 .local
In my opinion, it is a good practice to run Jupyter in a dedicated workbook folder.
$ mkdir jupyter_folder
$ jupyter-notebook --notebook-dir jupyter_folder
where 'jupyter_folder' is a folder in my home.
This method works without any permission issues.