Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbextension does not load from system-wide config #331

Closed
jorisvandenbossche opened this issue Aug 25, 2015 · 18 comments
Closed

nbextension does not load from system-wide config #331

jorisvandenbossche opened this issue Aug 25, 2015 · 18 comments

Comments

@jorisvandenbossche
Copy link
Contributor

Situation:

  • I have the RISE (livereveal) extension installed in the system wide data dir: /usr/local/share/jupyter/nbextensions/livereveal/

  • I have in my user config directory (~/.jupyter/nbconfig/) a notebook.json file that specifies to load livereveal/main by default -> this works (the extension is activated, so the extension is installed correctly and works)

  • If I put exactly the same notebook.json file in the system wide config location /usr/etc/jupyter/nbconfig/, the extension does not load, but I see an error in the webconsole:

    Failed to load extension: Array [ "nbextensions/livereveal" ] Error: Script error for: nbextensions/livereveal
    http://requirejs.org/docs/errors.html#scripterror
    Stacktrace:
    makeError@https://snake.ugent.be/user/jorvdnbo/static/components/requirejs/require.js?v=2de44fdcc1fe5e939aa4ce80626b241d:165:17
    newContext/context.onScriptError@https://snake.ugent.be/user/jorvdnbo/static/components/requirejs/require.js?v=2de44fdcc1fe5e939aa4ce80626b241d:1709:36
    

Any idea what would be causing this? Or how I can debug it to provide more info?

(for info: I am running it on a JupyterHub (https://snake.ugent.be) hosted at our university)

@damianavila
Copy link
Member

the system wide location should be /usr/local/etc/jupyter/ or /etc/jupyter/, I guess if you use them instead of /usr/etc/jupyter/nbconfig/ it should work...
You can probably make a quick test running the notebook with:
JUPTYER_CONFIG_DIR=/usr/etc/jupyter jupyter notebook

@jorisvandenbossche
Copy link
Contributor Author

When I ask for jupyter --paths, it gives me /etc/jupyter/:

root@snake:~# jupyter --paths
config:
    /users/j/jorvdnbo/.jupyter
    /usr/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /users/j/jorvdnbo/.local/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /users/j/jorvdnbo/.local/share/jupyter/runtime
root@snake:~# 

Further, if I tried to put in all locations, and keep getting the same error.

It also gives an error ('Failed to load extension: Array [ "nbextensions/livereveal" ]', see above). So it seems that it in some way finds the config, but cannot load the extension correctly when this is system config, but does correctly load it when specified in user config.

@damianavila
Copy link
Member

(jupyter)damian-S400CA :: /media/data/devel :: 
$ jupyter --path
config:
    /home/damian/.jupyter
    /home/damian/miniconda3/envs/jupyter/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/damian/.local/share/jupyter
    /home/damian/miniconda3/envs/jupyter/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /run/user/1000/jupyter

(jupyter)damian-S400CA :: /media/data/devel :: 
$ ls -la /usr/local/share/jupyter/nbextensions/
total 8
drwxr-xr-x 2 root root 4096 ago 26 21:16 .
drwxr-xr-x 4 root root 4096 ago 26 21:16 ..
lrwxrwxrwx 1 root root   56 ago 26 21:16 livereveal -> /media/data/devel/jupyter_project/live_reveal/livereveal

(jupyter)damian-S400CA :: /media/data/devel :: 
$ ls -la /usr/local/etc/jupyter/nbconfig/
total 20
drwxr-xr-x 2 root root 4096 ago 26 21:38 .
drwxr-xr-x 4 root root 4096 ago 26 21:38 ..
-rw-r--r-- 1 root root   81 ago 26 21:38 edit.json
-rw-r--r-- 1 root root  138 ago 26 21:38 livereveal.json
-rw-r--r-- 1 root root   58 ago 26 21:38 notebook.json

(jupyter)damian-S400CA :: /media/data/devel :: 
$ JUPYTER_CONFIG_DIR=/usr/local/etc/jupyter jupyter notebook

and RISE loaded fine for me...

@minrk
Copy link
Member

minrk commented Sep 11, 2015

@jorisvandenbossche what do you get from env | grep JUPYTER? and python -c 'import sys; print(sys.prefix)'

@jorisvandenbossche
Copy link
Contributor Author

env | grep JUPYTER returns nothing, and python -c 'import sys; print(sys.prefix)' returns /usr

@minrk
Copy link
Member

minrk commented Sep 16, 2015

Sorry for the delay. I just re-read this, and the frontend-config (nbconfig, config.js) can only be loaded from the user location right now. It will not look in system-wide locations.

@minrk minrk added this to the 5.0 milestone Sep 16, 2015
@damianavila
Copy link
Member

Ah... I missed that... not it makes sense. Thanks for the info @minrk

@jorisvandenbossche
Copy link
Contributor Author

@minrk aha, that could explain :-) Is this planned to be possible in the future? Or, what is the best way to enable an extension for all your users/students? (without copying nbconfig files) Is there a way to do this programmatically (eg in jupyter_notebook_config.py file? or is that also only loaded from user config?)

Further, the strange thing is that there is still some error in the web console about this extension, so in some way it does seem to do something with it ("Failed to load extension: Array [ "nbextensions/livereveal" ] Error: Script error for: nbextensions/livereveal", see initial post)

@minrk
Copy link
Member

minrk commented Sep 16, 2015

@jorisvandenbossche yes, I think we do want to enable something like this, anyway. It's more complicated for the frontend config.

@damianavila
Copy link
Member

Is there a way to do this programmatically (eg in jupyter_notebook_config.py file? or is that also only loaded from user config?)

You could do something like I suggested before...

JUPYTER_CONFIG_DIR=/usr/etc/jupyter/ jupyter notebook

So you "force" to look into that directory (or the one you choose...) for the nbconfig thing...

@minrk
Copy link
Member

minrk commented Sep 17, 2015

@damianavila that's a good point. One of the reasons it's nicer that Jupyter separates config from runtime info is that it is possible to have read-only config (IPython does not work with a read-only profile). So if you wanted to exert control over the notebook config, you can specify this path and it will all work.

@jorisvandenbossche
Copy link
Contributor Author

How can you do this in a jupyterhub context? As you do not run the jupyter notebook command explicitly

@jorisvandenbossche
Copy link
Contributor Author

And something else, if you do JUPYTER_CONFIG_DIR=/usr/etc/jupyter/ jupyter notebook, does jupyter still also looks in the user config directory? As I would like to enable an extension on the jupyterhub for all users, but not prevent that people install and enable extensions in their user directories.

@minrk
Copy link
Member

minrk commented Sep 17, 2015

@jorisvandenbossche you can specify environment variables and extra arguments to the server process via the Spawner.

does jupyter still also looks in the user config directory?

No, this would be taking strict control over the notebook server configuration. There is no current way to provide overridable system-wide defaults for frontend-config (custom.js, nbconfig) at this time.

@ellisonbg
Copy link
Contributor

@minrk is this a "no action" now? Close?

@minrk
Copy link
Member

minrk commented Oct 6, 2015

@ellisonbg no, I think there's still a place for us to add support for an additional js file and/or frontend config that's system-wide that doesn't override user config if it exists.

@damianavila
Copy link
Member

This should be solved by #879, I think...

@minrk minrk modified the milestones: 4.2, 5.0 Apr 9, 2016
@minrk minrk closed this as completed Apr 9, 2016
@minrk
Copy link
Member

minrk commented Apr 9, 2016

Indeed it is

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants