简体   繁体   中英

Jupyter notebook permission error

I'm having some issues with opening Jupyter. I just installed Anaconda, but got the same error as before when I try to write "Jupyter notebook" in terminal.

Johans-MBP:~ JDMac$ Jupyter notebook
Traceback (most recent call last):
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 501, in get
    value = obj._trait_values[self.name]
KeyError: 'runtime_dir'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/JDMac/anaconda3/bin/jupyter-notebook", line 6, in <module>
    sys.exit(notebook.notebookapp.main())
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 588, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 1021, in initialize
    self.init_configurables()
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 815, in init_configurables
    connection_dir=self.runtime_dir,
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 529, in __get__
    return self.get(obj, cls)
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 508, in get
    value = self._validate(obj, dynamic_default())
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 99, in _runtime_dir_default
    ensure_dir_exists(rd, mode=0o700)
  File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/ipython_genutils/path.py", line 167, in ensure_dir_exists
    os.makedirs(path, mode=mode)
  File "/Users/JDMac/anaconda3/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/JDMac/Library/Jupyter/runtime'

As I'm close to clueless with all of this, I need some assistance over here :)

the solution is run the following command on the terminal as a normal user

$ export XDG_RUNTIME_DIR="" then start the jupyter $jupyter notebook

it will not work as root user

如果您使用的是 macOS,这可能会对您有所帮助:

sudo chown -R `whoami`:staff ~/Library/Jupyter
  1. You may be working under the initial installers userid
  2. Go to Ananconda prompt and change directory with these 2 commands >cd.. and >cd yourusername .
  3. Use the command

    jupyter notebook

This worked for me.

The permission error may be due to directory is not in 777 mode. Please follow below command, it works for me:

sudo chmod -R 777 .local

You can change ".local" directory according to error occurred in your directory.

I also met a similar problem like this:

jupyter notebook
Traceback (most recent call last):
  File "c:\p\py353\lib\site-packages\traitlets\traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'log'
...

I install jupyter use PyCharm so just update jupyter and It was sovled.

command:

pip3 install --upgrade jupyter

if you use command below again: pip3 install jupyter it just print already installed but some dependent modules didn't update

As a root execute:

sudo nano  ~/.bashrc

Add at the begining of the file:

 export XDG_RUNTIME_DIR="" 

Press Ctrl-o to write file and Ctrl+x to exit.

Now type:

source ~/.bashrc 

If that doesn't work uninstall Jupyter notebook and make the current user (joe for example) own everything inside the folder (and the folder itself):

sudo chown -R $joe:joe /home/joe/.jupyter

pip install notebook --user

当我在 Win 10 中遇到“Jupyter notebook 权限错误”时,对我有用的是在管理员模式下运行终端并从那里编写“Jupyter notebook”。

I ran "whereis jupyter" to get the following output:

/snap/bin/jupyter /snap/bin/jupyter.ipython /snap/bin/jupyter.nbconvert

Then I ran the following command:

sudo chmod -R 755 /snap/bin/jupyter

Previously, I was trying to set the permission for the folder where I was opening a Jupyter notebook. It did not work. It seems that the permission needs to be set for the folder where jupyter is located.

I was having the same problem! Then I opened a terminal and changed to the directory folder that I was trying to work and opened the jupyter notebook and that worked for me. My folder was in the /media folder.

Paulo

I ended up opening up my Jupyter notebook using sudo in my terminal of my Mac.

sudo jupyter-notebook --allow-root

I tried the other solutions proposed in this post and this was the one that worked for me in solving my persistent permission errors for reading/saving files from my Jupyter notebook. Granted this approach might raise some security concerns, so I encourage others to provide critique if they find any potential fault in it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM