jupyter_core
jupyter_core copied to clipboard
jupyter nbextension enable --sys-prefix tries to write in $HOME/.jupyter
When executing the command
jupyter nbextension enable --sys-prefix --py widgetsnbextension
I would expect this to only touch system files in sys.prefix
. However, this actually tries to create the directory $HOME/.jupyter
.
Traceback (most recent call last) when executing the above command as locked-down user with limited access to $HOME
:
File "/home/worker/sage-patchbot/local/bin/jupyter-nbextension", line 6, in <module>
main()
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 595, in launch_instance
app.initialize(argv)
File "<decorator-gen-6>", line 2, in initialize
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/jupyter_core/application.py", line 239, in initialize
self.parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 488, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 426, in initialize_subcommand
self.subapp.initialize(argv)
File "<decorator-gen-6>", line 2, in initialize
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/jupyter_core/application.py", line 243, in initialize
self.migrate_config()
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/jupyter_core/application.py", line 169, in migrate_config
migrate()
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/jupyter_core/migrate.py", line 240, in migrate
ensure_dir_exists(env['jupyter_config'])
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/ipython_genutils/path.py", line 167, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/home/worker/sage-patchbot/local/lib/python/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/worker/.jupyter'
CC @SylvainCorlay
- enabling the extension with --sys-prefix should require the same privileges as the pip install.
- indeed it should create a directory in sys.prefix
- if your sys-prefix is a subdirectory of home, these should not require sudo privileges
I don't know what is going on here. What is the os exactly?
indeed it should create a directory in sys.prefix
Which it does correctly. However, it additionally does something in $HOME
.
if your sys-prefix is a subdirectory of home, these should not require sudo privileges
sys.prefix
is not inside $HOME
in this case. This issue is for the situation where I have access to sys.prefix
but not to $HOME
. You could correctly argue that this is an unusual situation. Still, when installing stuff as root
I don't want Jupyter to create /root/.jupyter
.
What is the os exactly?
Linux sage4 3.2.1-gentoo-r2 #15 SMP Tue May 15 10:40:50 CEST 2012 x86_64 Intel(R) Xeon(R) CPU X5660 @ 2.80GHz GenuineIntel GNU/Linux
File "/home/worker/sage-patchbot/local/lib/python2.7/site-packages/jupyter_core/application.py", line 243, in initialize
self.migrate_config()
It's the base Jupyter application trying to migrate IPython config to Jupyter. It will skip this if either:
-
~/.jupyter/migrated
exists, or -
~/.ipython
does not exist
You could also set JUPYTER_CONFIG_DIR
to a writeable scratch directory to have it operate there instead.
It will skip this if either:
~/.ipython does not exist
No, it does not. In my case, $HOME/.ipython
does not exist. In fact, $HOME
is almost empty (containing a hand-picked minimal set of things that I need).
But since I am guessing you are talking about a sagemath install you may have ~/.sage/ipython
and the variable IPYTHONDIR
points there in your environment.
closing this due to inactivity, Happy hacking! :bowtie: