Jupyter-contrib/jupyter_nbextensions_configurator

No module named 'notebook.base'

mpechner-akasa opened this issue · 5 comments

Last time I built this docker this worked. I added the pip install notebook because of the error. It ws all one run line. Broke it up to get more info.

Adding Jupyter to a docker.
env is python 3.8
OS ubuntu 22.0.4

Commands:

# Jupyter extensions
RUN  pip install cython
RUN  pip install notebook
RUN  pip install jupyter
RUN  jupyter contrib nbextension install. <- fails here
RUN  jupyter nbextensions_configurator enable

Stack strace:

=> CACHED [28/46] RUN  pip install cython                                                                                                                                                                                                 0.0s
=> CACHED [29/46] RUN  pip install notebook                                                                                                                                                                                               0.0s
=> CACHED [30/46] RUN  pip install jupyter                                                                                                                                                                                                0.0s
=> ERROR [31/46] RUN  jupyter contrib nbextension install                                                                                                                                                                                 1.2s

 ------
[31/46] RUN  jupyter contrib nbextension install:
#0 1.080 Traceback (most recent call last):
#0 1.080   File "/root/venv/bin/jupyter-contrib", line 8, in <module>
#0 1.080     sys.exit(main())
#0 1.080   File "/root/venv/lib/python3.8/site-packages/jupyter_core/application.py", line 285, in launch_instance
#0 1.080     return super().launch_instance(argv=argv, **kwargs)
#0 1.080   File "/root/venv/lib/python3.8/site-packages/traitlets/config/application.py", line 1041, in launch_instance
#0 1.080     app = cls.instance(**kwargs)
#0 1.080   File "/root/venv/lib/python3.8/site-packages/traitlets/config/configurable.py", line 551, in instance
#0 1.080     inst = cls(*args, **kwargs)
#0 1.080   File "/root/venv/lib/python3.8/site-packages/jupyter_contrib_core/application.py", line 27, in __init__
#0 1.080     self._refresh_subcommands()
#0 1.080   File "/root/venv/lib/python3.8/site-packages/jupyter_contrib_core/application.py", line 43, in _refresh_subcommands
#0 1.080     get_subcommands_dict = entrypoint.load()
#0 1.080   File "/root/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2518, in load
#0 1.080     return self.resolve()
#0 1.080   File "/root/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2524, in resolve
#0 1.080     module = __import__(self.module_name, fromlist=['__name__'], level=0)
#0 1.080   File "/root/venv/lib/python3.8/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
#0 1.080     import jupyter_nbextensions_configurator
#0 1.080   File "/root/venv/lib/python3.8/site-packages/jupyter_nbextensions_configurator/__init__.py", line 18, in <module>
#0 1.080     from notebook.base.handlers import APIHandler, IPythonHandler
#0 1.080 ModuleNotFoundError: No module named 'notebook.base'
------
ERROR: failed to solve: executor failed running [/bin/sh -c jupyter contrib nbextension install]: exit code: 1
make: *** [Makefile:31: build-dev] Error 1

It looks like notebook/base exists:

> (venv) root@ip-172-31-112-159:~/venv/lib/python3.8/site-packages# ls -ld notebook*
> drwxr-xr-x 21 root root 4096 Oct  3  2022 notebook
> drwxr-xr-x  2 root root  126 Oct  3  2022 notebook-6.4.12.dist-info
> 
> (venv) root@ip-172-31-112-159:~/venv/lib/python3.8/site-packages# ls notebook
> __init__.py  __pycache__  _tz.py       auth  bundler            edit           files    i18n       kernelspecs  nbconvert        notebook        prometheus           services  templates  tests          transutils.py  utils.py
> __main__.py  _sysinfo.py  _version.py  base  config_manager.py  extensions.py  gateway  jstest.py  log.py       nbextensions.py  notebookapp.py  serverextensions.py  static    terminal   traittypes.py  tree           view
> (venv) root@ip-172-31-112-159:~/venv/lib/python3.8/site-packages# 

I ran into this yesterday. It appears that in notebook v 7.0 (published two days ago) they removed the base module: https://github.com/jupyter/notebook/tree/dc2082c84c3f29ecf31f3a05e9b51cf401d5dddd/notebook

You can force notebook to version 6.5 and the configurator will continue to work.

@jbohren Thank you, that was the magic. I guess keep checking to see when nbextension starts using version 7 of notebook. i refresh my docker images every 60 days.

Fixed - all good

This does not seem to be fixed for me.
I followed instructions (using mamba instead of conda) to install the jupyter_nbextensions_configurator on jupyter notebook 7.0.7 but got the following error:

$ mamba install -c conda-forge jupyter_nbextensions_configurator
...
ModuleNotFoundError: No module named 'notebook.base'

I have also not seen any description of this version conflict or a way of using jupyter nbextensions on notebook >6.5.