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

Error using jupyter_nbextensions_configurator with nbclassic #140

Closed
scmmmh opened this issue Aug 15, 2022 · 12 comments · Fixed by Jupyter-contrib/jupyter_nbextensions_configurator#141

Comments

@scmmmh
Copy link

scmmmh commented Aug 15, 2022

I'm trying to use nbclassic (0.4.2.) with the jupyter_nbextensions_configurator using the notebook_shim and getting the following error:

[I 2022-07-07 13:15:54.243 ServerApp] notebook_shim | extension was successfully loaded.
[D 2022-07-07 13:15:54.243 ServerApp] [jupyter_nbextensions_configurator] Loading 0.4.1
[D 2022-07-07 13:15:54.243 ServerApp] [jupyter_nbextensions_configurator]   Editing templates path to add /usr/local/lib/python3.9/site-packages/jupyter_nbextensions_configurator/templates
[D 2022-07-07 13:15:54.243 ServerApp] [jupyter_nbextensions_configurator]   Editing nbextensions path to add /usr/local/lib/python3.9/site-packages/jupyter_nbextensions_configurator/static
[D 2022-07-07 13:15:54.243 ServerApp] Traceback (most recent call last):
      File "/usr/local/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 351, in load_extension
        extension.load_all_points(self.serverapp)
      File "/usr/local/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 231, in load_all_points
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
      File "/usr/local/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 231, in <listcomp>
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
      File "/usr/local/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 224, in load_point
        return point.load(serverapp)
      File "/usr/local/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 150, in load
        return loader(serverapp)
      File "/usr/local/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 247, in load_jupyter_server_extension
        if static_files_path not in webapp.settings['nbextensions_path']:
    KeyError: 'nbextensions_path'
    
[W 2022-07-07 13:15:54.243 ServerApp] jupyter_nbextensions_configurator | extension failed loading with message: 'nbextensions_path'

I have also reported this here: jupyter/notebook_shim#9, but I'm not sure which project it is best reported in.

@echarles
Copy link
Member

Thx @scmmmh for reporting. I have the same issue and will look for a fix.

@echarles
Copy link
Member

Just opened Jupyter-contrib/jupyter_nbextensions_configurator#141 to fix this.

@echarles
Copy link
Member

Jupyter-contrib/jupyter_nbextensions_configurator#141 is waiting for reviews from the core maintainers. Please upvote that PR in the jupyter-contrib repository if you want to get this move forward.

@dleen
Copy link
Contributor

dleen commented Nov 2, 2022

Just saw the link to the docs:

    $ pip install jupyter_nbextensions_configurator
    $ jupyter nbextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
    $ jupyter nbextension enable --sys-prefix --py jupyter_nbextensions_configurator
    $ jupyter serverextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
    $ jupyter serverextension enable --sys-prefix --py jupyter_nbextensions_configurator

Thanks @echarles !

That indeed fixes the stack trace. However when I apply the patch locally I am still seeing a bunch of 404s for the configurator:

[W 2022-11-02 19:59:16.514 ServerApp] 404 GET /nbextensions/nbextensions_configurator/tree_tab/main.js

and the configurator doesn't actually load.

Any pointers where I might start debugging this?

For example:

jupyter nbclassic-extension list                                                   

Known nbextensions:
  config dir: /Users/dleen/.jupyter/nbconfig
    notebook section
      nbextensions_configurator/config_menu/main  enabled
      - Validating: problems found:
        - require?  X nbextensions_configurator/config_menu/main
    tree section
      nbextensions_configurator/tree_tab/main  enabled
      - Validating: problems found:
        - require?  X nbextensions_configurator/tree_tab/main

@echarles
Copy link
Member

echarles commented Nov 3, 2022

Thx for trying out @dleen and reporting here.

I have tested in a clean env and opened #174 to update the documentation. The following steps worked fine for me (the extension configuration is show and operational, no 404).

pip install nbclassic
pip install 'jupyter_nbextensions_configurator @ git+https://github.com/datalayer-externals/jupyter-notebook-configurator.git@fix/nbclassic#egg=jupyter_nbextensions_configurator'
jupyter nbclassic-extension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
jupyter nbclassic-extension enable --sys-prefix --py jupyter_nbextensions_configurator
jupyter nbclassic-serverextension enable --sys-prefix --py jupyter_nbextensions_configurator
jupyter nbclassic

Screenshot 2022-11-03 at 10 23 29

Screenshot 2022-11-03 at 10 23 46

@echarles
Copy link
Member

echarles commented Nov 3, 2022

If I install and enable the last published jupyter_nbextensions_configuratorand launch jupyter notebook (6.5.x), I get the following warning (the extension works fine).

[W 10:50:32.585 NotebookApp] [jupyter_nbextensions_configurator] nbextension 'nbextensions_configurator/config_menu/main' has duplicate listings in both '/Users/echarles/opt/miniconda3/envs/notebook/lib/python3.9/site-packages/jupyter_nbextensions_configurator/static/nbextensions_configurator/config_menu/config_menu.yaml' and '/Users/echarles/opt/miniconda3/envs/notebook/share/jupyter/nbextensions/nbextensions_configurator/config_menu/config_menu.yaml'

@echarles
Copy link
Member

echarles commented Nov 3, 2022

To add more info related to #140 (comment)

After enabling with jupyter nclassic-* and launching with jupyter nbclassic or jupyter notebook does not show any 404 and the extension is working fine on my env.

@echarles
Copy link
Member

jupyter_nbextensions_configurator 0.6.1 has just been released and should fix this issue. Please test in you env and report if it works or not for you with the latest nbclassic and/or notebook 6. Thx.

@echarles
Copy link
Member

If you test with nbclassic, please use the following commands before testing

jupyter nbclassic-extension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
jupyter nbclassic-extension enable --sys-prefix --py jupyter_nbextensions_configurator
jupyter serverextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
jupyter serverextension enable --sys-prefix --py jupyter_nbextensions_configurator

For notebook:

jupyter nbextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
jupyter nbextension enable --sys-prefix --py jupyter_nbextensions_configurator
jupyter serverextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
jupyter serverextension enable --sys-prefix --py jupyter_nbextensions_configurator

@dleen
Copy link
Contributor

dleen commented Nov 16, 2022

@echarles That's great news!

I don't believe the install command exists:

jupyter serverextension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite

e.g.

> jupyter serverextension
Please supply at least one subcommand: disable, enable, list

@scmmmh
Copy link
Author

scmmmh commented Nov 21, 2022

I can confirm that this now works for me.

@echarles
Copy link
Member

Thx. Closing as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants