Cannot open new Jupyter Notebook [Permission Denie

2019-02-09 01:07发布

问题:

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'

回答1:

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.



回答2:

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


回答3:

It might be a trust issue.
Command-line
jupyter trust /path/to/notebook.ipynb
here is the documentation link :
http://jupyter-notebook.readthedocs.io/en/latest/security.html#security-in-notebook-documents



回答4:

I had the very same issue running Jupyter. After chasing my tail on permissions, I found that everything cleared up after I changed ownership on the directory where I was trying to run/store my notebooks. Ex.: I was running my files out of my ~/bash dir. That was root:root; when I changed it to jim:jim....no more errors.



回答5:

  1. Open Anaconda prompt
  2. Go to C:\Users\your_name
  3. Write jupyter trust untitled.ipynb
  4. Then, write jupyter notebook


回答6:

This worked for me:

-> uninstalled Jupyter
-> install jupyter in Python36 folder
-> open Jupyter from command prompt instead of git bash.


回答7:

I had to run chown recursively for all subfolders With /* . Than it worked:

sudo chown -R user:usergroup /home/user/.local/share/jupyter/*


回答8:

On a Windows machine run the python command prompt as administrator. That should resolved the permissions issue when creating a new python 3 notebook.



回答9:

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 work without permission issue.



回答10:

The top answer here didn't quite fix the problem, although it's probably a necessary step:

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

(user should be whoever is the logged in user running the notebook server) This changes the folder owner to the user running the server, giving it full access.

After doing this, the error message said it didn't have permission to create the checkpoint file in ~/.ipynb_checkpoints/ so I also changed ownership of that folder (which was previously root)

sudo chown -R user:user ~/.ipynb_checkpoints/

And then I was able to create and save a notebook!