Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot open new Jupyter Notebook [Permission Denied]

I have installed Jupyter Notebook on ubuntu 16.04 using pip3. I can execute jupyter notebook command. It opens and shows a list of current path directories.

But I cannot create a new notebook(Python3). It says

Unexpected error while saving file: Deep Learning/NN/Untitled.ipynb [Errno 13] Permission denied: '/home/ubuntu/.local/share/jupyter/notebook_secret'

like image 436
CodeNinja101 Avatar asked Sep 18 '17 06:09

CodeNinja101


People also ask

How do I give permission to a Jupyter Notebook?

You can set access control for Jupyter notebooks at the account level and at the object level. This feature is available in the latest version of Jupyter Notebooks. If you are not using the latest version of Jupyter notebooks, you can enable this feature from the Control Panel >> Account Features page.

How do I resolve permission error in Jupyter Notebook?

The PermissionError: [errno 13] permission denied error occurs when you try to access a file from Python without having the necessary permissions. To fix this error, use the chmod or chown command to change the permissions of the file so that the right user and/or group can access the file.

Why I Cannot open my Jupyter Notebook?

Jupyter fails to start If you're using a menu shortcut or Anaconda launcher to start it, try opening a terminal or command prompt and running the command jupyter notebook . If it can't find jupyter , you may need to configure your PATH environment variable.

How do I open a new Jupyter Notebook?

Once you've entered your specific folder with Windows Explorer, you can simply press ALT + D, type in cmd and press Enter. You can then type jupyter notebook to launch Jupyter Notebook within that specific folder.


2 Answers

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.

like image 188
Ganesh Pandey Avatar answered Oct 18 '22 21:10

Ganesh Pandey


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.

like image 15
Zompa Avatar answered Oct 18 '22 22:10

Zompa