jupyter_nbextensions_configurator icon indicating copy to clipboard operation
jupyter_nbextensions_configurator copied to clipboard

[jupyterhub] 404 on nbextensions/nbextensions_configurator

Open dsblank opened this issue 9 years ago • 11 comments

I'm on jupyterhub. I'm trying to us the configurator on latest versions of everything (Aug 19, 2016). I have installed everything according to README, and it shows as enabled (as root):

# jupyter-nbextension list
Known nbextensions:
  config dir: /root/.jupyter/nbconfig
    notebook section
      dragdrop/main  enabled 
      - Validating: OK
  config dir: /opt/anaconda3/etc/jupyter/nbconfig
    notebook section
      calysto/cell-tools/main  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
      codefolding/main disabled
      nbextensions_configurator/config_menu/main  enabled 
      - Validating: OK
      calysto/spell-check/main  enabled 
      - Validating: OK
      calysto/submit/main  enabled 
      - Validating: OK
      calysto/document-tools/main  enabled 
      - Validating: OK
      calysto/publish/main  enabled 
      - Validating: OK
    tree section
      ipyparallel/main  enabled 
      - Validating: OK
      nbextensions_configurator/tree_tab/main  enabled 
      - Validating: OK

However, when I load the notebook (after restarting jupyterhub) the tab shows, it is empty and I get the following error in the Javascript console:

screenshot from 2016-08-19 15 23 38

Why is the URL giving a 404? Maybe I didn't install the app properly for jupyterhub? Any hints?

dsblank avatar Aug 19 '16 19:08 dsblank

Hi Doug,

Not sure exactly why this is giving a 404, but my first guess is that the server extension part isn't loading for some reason. In this configurator, the nbextensions files reside in the python packages directory, which is insrted into the server's nbextensions_path at runtime. Do you get any entries in the server logs from, e.g. https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator/blob/5d103e839bd41fce3bd8154b72c0cba819260b06/src/jupyter_nbextensions_configurator/init.py#L192-L193 and is there anything in the referenced folders?

jcb91 avatar Aug 19 '16 23:08 jcb91

also, does the config page at https://athena.brynmawr.edu/jupyter/user/dblank/nbextensions load correctly at all? I'd guess probably not...

jcb91 avatar Aug 19 '16 23:08 jcb91

Thanks for any hints you can give! This is the entire log on startup:

[D 2016-08-19 19:21:52.836 JupyterHub application:529] Looking for jupyterhub_config in None
[D 2016-08-19 19:21:52.837 JupyterHub application:549] Loaded config file: /root/jupyterhub_config.py
[D 2016-08-19 19:21:52.839 JupyterHub application:261] Config changed:
[D 2016-08-19 19:21:52.840 JupyterHub application:262] {'NotebookApp': {'server_extensions': <traitlets.config.loader.LazyConfigValue object at 0x7fcc45fb5978>}, 'Authenticator': {'admin_users': {...}}, 'JupyterHub': {'ssl_cert': '...', 'port': 3939, 'proxy_auth_token': '...', 'log_level': 10, 'base_url': '/jupyter/', 'ssl_key': '...'}}
[I 2016-08-19 19:21:52.940 JupyterHub app:1237] Hub API listening on http://127.0.0.1:8081/jupyter/hub/
[I 2016-08-19 19:21:52.944 JupyterHub app:974] Starting proxy @ http://*:3939/
19:21:53.158 - info: [ConfigProxy] Proxying https://*:3939 to http://127.0.0.1:8081
19:21:53.162 - info: [ConfigProxy] Proxy API at http://127.0.0.1:3940/api/routes
[D 2016-08-19 19:21:53.252 JupyterHub app:1003] Proxy started and appears to be up
[I 2016-08-19 19:21:53.253 JupyterHub app:1260] JupyterHub is now running at http://127.0.0.1:3939/

What folders? That URL either gives 404, or never responds.

dsblank avatar Aug 19 '16 23:08 dsblank

So that log should include all entries from each single-user server as well as entries from the hub, correct? (I've not used jupyterhub much, so am a little uncertain) What I'd hope to see would be something like

[D 00:56:45.140 NotebookApp] Loading extension jupyter_nbextensions_configurator
[D 00:56:45.141 NotebookApp]   Editing template path to add /Users/josh/Documents/workspace/jupyter_nbextensions_configurator/.tox/py34-notebook/lib/python3.4/site-packages/jupyter_nbextensions_configurator/templates
[D 00:56:45.141 NotebookApp]   Editing nbextensions path to add /Users/josh/Documents/workspace/jupyter_nbextensions_configurator/.tox/py34-notebook/lib/python3.4/site-packages/jupyter_nbextensions_configurator/static
[D 00:56:45.141 NotebookApp]   Adding new handlers
[I 00:56:45.148 NotebookApp] Loaded extension jupyter_nbextensions_configurator

But, since it isn't there, it seems as though for some reason perhaps the server extension hasn't been enabled for whatever user the server is running as. To enable system-wide, you could try jupyter nbextensions_configurator enable, though I assume you've already tried this, following the README. In that case, it's possible that since you're setting NotebookApp.server_extensions in /root/jupyterhub_config.py, it's interfering with somethign set elsewhere. What version of notebook are you using?

jcb91 avatar Aug 20 '16 00:08 jcb91

What should NotebookApp.server_extensions be set to?

dsblank avatar Aug 20 '16 00:08 dsblank

Assuming you're using a notebook version < 4.2, it should be a list of strings, each of which is an importable serverextension module. So, to enable the 'jupyter_nbextensions_configurator' module, the list should contain 'jupyter_nbextensions_configurator'. You could, for example, add the line

c.NotebookApp.setdefault('server_extensions', []).append('jupyter_nbextensions_configurator')

to the python config file (assuming the usual method of assigning the config value to the variable c).

For notebook versions >= 4.2, the syntax changed slightly to use a dict named NotebookApp.nbserver_extensions, where each key is the module name, and the value is its enabled status. So, in this case, you could add the line

c.NotebookApp.setdefault('nbserver_extensions', {})['jupyter_nbextensions_configurator'] = True

to the python config file.

jcb91 avatar Aug 20 '16 00:08 jcb91

However, given that the file is jupyterhub_config.py, and not jupyter_notebook_config.py, I suspect it may only be loaded by the hub, and not each single-user notebook server...

jcb91 avatar Aug 20 '16 00:08 jcb91

It seems possible that this is related to #13

jcb91 avatar Aug 22 '16 13:08 jcb91

I ran out of time to track this down. I'll leave this for now. Perhaps someone can debug on a jupyterhub server and report back. Thanks!

dsblank avatar Aug 22 '16 18:08 dsblank

Well, at any rate, #13 was a bug preventing the serverextension from loading correctly when using jupyterhub, so it's something that needed fixing to solve this issue. As I mentioned there, I'd like to add a travis test using jupyterhub, but don't fully understand how to do that yet, and don;t quite have time right now. I'll ping here if & when I get one working.

jcb91 avatar Aug 22 '16 19:08 jcb91

#13 has now been included in the 0.2.2 release on pip & conda-forge (though conda-forge seems to be experiencing issues building today, so might take a while to get uploaded properly)

jcb91 avatar Sep 08 '16 14:09 jcb91