Jupyter permission denied error

Hi!

I’ve been getting the following error when trying to start an interactive session with Jupyter:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/traitlets/traitlets.py", line 528, 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 "/usr/local/bin/jupyter-notebook", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/jupyter_core/application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance
    app.initialize(argv)
  File "/usr/local/lib/python3.6/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 2148, in initialize
    self.init_configurables()
  File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1650, in init_configurables
    connection_dir=self.runtime_dir,
  File "/usr/local/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/usr/local/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/usr/local/lib/python3.6/site-packages/jupyter_core/application.py", line 95, in _runtime_dir_default
    ensure_dir_exists(rd, mode=0o700)
  File "/usr/local/lib/python3.6/site-packages/jupyter_core/utils/__init__.py", line 11, in ensure_dir_exists
    os.makedirs(path, mode=mode)
  File "/usr/lib64/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib64/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib64/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  [Previous line repeated 1 more time]
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/myuser'

Unfortunately, in this case, I don’t have the /home directory exported to the nodes, so it’s necessary to use another directory to store $HOME/.local. I tried modifying the c.NotebookApp.notebook_dir option in config.py, but I’m still getting the error.
Could you assist me?

Thanks!
Nícolas

From looking at the stacktrace here - looks like current versions of jupyter respond to the JUPYTER_RUNTIME_DIR environment variable. Though previous versions seemed to have responded to XDG_RUNTIME_DIR though I can’t tell what version you’re on and what will work.

After you resolve that you may also run into issues with JUPYTER_DATA_DIR which is similar.

1 Like

Hi Jeff!

Thank you very much! Setting the JUPYTER_RUNTIME_DIR and JUPYTER_DATA_DIR variables solved the issue.

Thanks again!

1 Like