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

jupyter_contrib_nbextenions appears to be incompatible with Jupyter Notebook v7. #1647

Open
txoof opened this issue Aug 1, 2023 · 6 comments

Comments

@txoof
Copy link

txoof commented Aug 1, 2023

Major Edits:

It appears that this is no longer compatible with Jupyter Notebook V7. The contrib_nbextenions executable attempts to load files from the notebook/base path which no longer exists as of V7.

It appears that major changes are necessary to make this project work with notebook V7.

See also: #1640

Issue

Running any of the following contbrib/nbextension command results in a ModuleNotFoundError: No module named 'notebook.base' error . I have a similar setup on a similar raspberry pi from a few months ago and it works just fine. I used an ansible playbook to install and set this up for both Pis, so I'm pretty confident that I haven't done anything different between the two.

Commands:

  • jupyter-nbextensions_configuratior
  • jupyter contrib

This is a completely fresh, out of the box RasPi OS Lite install. I've installed the Python3 module using apt (apt install python3 python-setuptools python3-pip python3-gpiozero pytyhon-dev). I then installed jupyter, jupyterthemes, jupyter_contrib_nbexteions and pipenv using pip3.

Full error output

$ ./jupyter-nbextensions_configurator
Traceback (most recent call last):
  File "/home/pi/.local/bin/./jupyter-nbextensions_configurator", line 5, in <module>
    from jupyter_nbextensions_configurator.application import main
  File "/home/pi/.local/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 18, in <module>
    from notebook.base.handlers import APIHandler, IPythonHandler
ModuleNotFoundError: No module named 'notebook.base'

What I've tried so far

Reinstalling jupyter_contrib_nbextensions

$ pip3 uninstall jupyter_contrib_nbextensions
Found existing installation: jupyter-contrib-nbextensions 0.7.0
Uninstalling jupyter-contrib-nbextensions-0.7.0:
  Would remove:
    /home/pi/.local/bin/jupyter-contrib-nbextension
    /home/pi/.local/lib/python3.9/site-packages/jupyter_contrib_nbextensions-0.7.0.dist-info/*
    /home/pi/.local/lib/python3.9/site-packages/jupyter_contrib_nbextensions/*
Proceed (y/n)? y
  Successfully uninstalled jupyter-contrib-nbextensions-0.7.0

$ pip3 install jupyter-contrib-nbextensions
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting jupyter-contrib-nbextensions
  Using cached https://www.piwheels.org/simple/jupyter-contrib-nbextensions/jupyter_contrib_nbextensions-0.7.0-py2.py3-none-any.whl (23.4 MB)
Requirement already satisfied: notebook>=6.0 in ./.local/lib/python3.9/site-packages (from jupyter-contrib-nbextensions) (7.0.1)
Requirement already satisfied: lxml in ./.local/lib/python3.9/site-packages (from jupyter-contrib-nbextensions) (4.9.3)
...SNIP...
Requirement already satisfied: asttokens>=2.1.0 in ./.local/lib/python3.9/site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook>=6.0->jupyter-contrib-nbextensions) (2.2.1)
Requirement already satisfied: executing>=1.2.0 in ./.local/lib/python3.9/site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook>=6.0->jupyter-contrib-nbextensions) (1.2.0)
Requirement already satisfied: pure-eval in ./.local/lib/python3.9/site-packages (from stack-data->ipython>=7.23.1->ipykernel->jupyterlab<5,>=4.0.2->notebook>=6.0->jupyter-contrib-nbextensions) (0.2.2)
Installing collected packages: jupyter-contrib-nbextensions
Successfully installed jupyter-contrib-nbextensions-0.7.0

System Information

OS Information:

PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian

Python Information

Version: Python 3.9.2

All python modules were installed using pip3, not the debian package manager. The python entry files in ~/.local/bin source /usr/bin/python3 so it doesn't look like this is some weird issue of using different versions of python.

Jupyter Information

Selected Jupyter core packages...
IPython          : 8.14.0
ipykernel        : 6.25.0
ipywidgets       : 8.1.0
jupyter_client   : 8.3.0
jupyter_core     : 5.3.1
jupyter_server   : 2.7.0
jupyterlab       : 4.0.3
nbclient         : 0.8.0
nbconvert        : 7.7.3
nbformat         : 5.9.2
notebook         : 7.0.1
qtconsole        : 5.4.3
traitlets        : 5.9.0
$ ./jupyter-troubleshoot
$PATH:
	/usr/local/bin
	/usr/bin
	/bin
	/usr/games
	/home/pi/.local/bin
	/usr/local/bin

sys.path:
	/home/pi/.local/bin
	/usr/lib/python39.zip
	/usr/lib/python3.9
	/usr/lib/python3.9/lib-dynload
	/home/pi/.local/lib/python3.9/site-packages
	/usr/local/lib/python3.9/dist-packages
	/usr/lib/python3/dist-packages
	/usr/lib/python3.9/dist-packages

sys.executable:
	/usr/bin/python3

sys.version:
	3.9.2 (default, Mar 12 2021, 04:06:34)
	[GCC 10.2.1 20210110]

platform.platform():
	Linux-6.1.21-v8+-aarch64-with-glibc2.31

which -a jupyter:
	/home/pi/.local/bin/jupyter

pip list:
	Package                           Version
	--------------------------------- ---------
	anyio                             3.7.1
	argon2-cffi                       21.3.0
	argon2-cffi-bindings              21.2.0
	arrow                             1.2.3
	asttokens                         2.2.1
	async-lru                         2.0.4
	attrs                             23.1.0
	Babel                             2.12.1
	backcall                          0.2.0
	beautifulsoup4                    4.12.2
	bleach                            6.0.0
	certifi                           2020.6.20
	cffi                              1.15.1
	chardet                           4.0.0
	charset-normalizer                3.2.0
	colorzero                         1.1
	comm                              0.1.3
	contourpy                         1.1.0
	cycler                            0.11.0
	debugpy                           1.6.7
	decorator                         5.1.1
	defusedxml                        0.7.1
	distlib                           0.3.7
	distro                            1.5.0
	dotfiles                          0.6.4
	exceptiongroup                    1.1.2
	executing                         1.2.0
	fastjsonschema                    2.18.0
	filelock                          3.12.2
	fonttools                         4.41.1
	fqdn                              1.5.1
	gpiozero                          1.6.2
	idna                              2.10
	importlib-metadata                6.8.0
	importlib-resources               6.0.0
	ipykernel                         6.25.0
	ipython                           8.14.0
	ipython-genutils                  0.2.0
	ipywidgets                        8.1.0
	isoduration                       20.11.0
	jedi                              0.19.0
	Jinja2                            3.1.2
	json5                             0.9.14
	jsonpointer                       2.4
	jsonschema                        4.18.4
	jsonschema-specifications         2023.7.1
	jupyter                           1.0.0
	jupyter-client                    8.3.0
	jupyter-console                   6.6.3
	jupyter-contrib-core              0.4.2
	jupyter-contrib-nbextensions      0.7.0
	jupyter-core                      5.3.1
	jupyter-events                    0.7.0
	jupyter-highlight-selected-word   0.2.0
	jupyter-lsp                       2.2.0
	jupyter-nbextensions-configurator 0.6.3
	jupyter-server                    2.7.0
	jupyter-server-terminals          0.4.4
	jupyterlab                        4.0.3
	jupyterlab-pygments               0.2.2
	jupyterlab-server                 2.24.0
	jupyterlab-widgets                3.0.8
	jupyterthemes                     0.20.0
	kiwisolver                        1.4.4
	lesscpy                           0.15.1
	lxml                              4.9.3
	MarkupSafe                        2.1.3
	matplotlib                        3.7.2
	matplotlib-inline                 0.1.6
	mistune                           3.0.1
	nbclient                          0.8.0
	nbconvert                         7.7.3
	nbformat                          5.9.2
	nest-asyncio                      1.5.7
	notebook                          7.0.1
	notebook-shim                     0.2.3
	numpy                             1.25.2
	overrides                         7.3.1
	packaging                         23.1
	pandocfilters                     1.5.0
	parso                             0.8.3
	pexpect                           4.8.0
	picamera2                         0.3.12
	pickleshare                       0.7.5
	pidng                             4.0.9
	piexif                            1.1.3
	Pillow                            8.1.2
	pip                               20.3.4
	pipenv                            2023.7.23
	platformdirs                      3.10.0
	ply                               3.11
	prometheus-client                 0.17.1
	prompt-toolkit                    3.0.39
	psutil                            5.9.5
	ptyprocess                        0.7.0
	pure-eval                         0.2.2
	pycparser                         2.21
	Pygments                          2.15.1
	pyparsing                         3.0.9
	python-apt                        2.2.1
	python-dateutil                   2.8.2
	python-json-logger                2.0.7
	python-prctl                      1.7
	PyYAML                            6.0.1
	pyzmq                             25.1.0
	qtconsole                         5.4.3
	QtPy                              2.3.1
	referencing                       0.30.0
	requests                          2.31.0
	rfc3339-validator                 0.1.4
	rfc3986-validator                 0.1.1
	rpds-py                           0.9.2
	RPi.GPIO                          0.7.0
	Send2Trash                        1.8.2
	setuptools                        68.0.0
	simplejpeg                        1.6.4
	six                               1.16.0
	sniffio                           1.3.0
	soupsieve                         2.4.1
	spidev                            3.5
	ssh-import-id                     5.10
	stack-data                        0.6.2
	terminado                         0.17.1
	tinycss2                          1.2.1
	toml                              0.10.1
	tomli                             2.0.1
	tornado                           6.3.2
	traitlets                         5.9.0
	typing-extensions                 4.7.1
	uri-template                      1.3.0
	urllib3                           1.26.5
	v4l2-python3                      0.3.2
	virtualenv                        20.24.2
	virtualenv-clone                  0.5.7
	wcwidth                           0.2.6
	webcolors                         1.13
	webencodings                      0.5.1
	websocket-client                  1.6.1
	wheel                             0.34.2
	widgetsnbextension                4.0.8
	zipp                              3.16.2
@txoof
Copy link
Author

txoof commented Aug 1, 2023

Disregard everything below this point; this is totally irrelevant.

I've done some more investigation and it seems that the problem is related to how the path's are sourced though I have no idea what the **actual** problem is.

Here's the current function

__version__ = 0.7.0
def _jupyter_nbextension_paths():
    """Magically-named function for jupyter extension installations."""
    nbextension_dirs = [
        os.path.join(os.path.dirname(__file__), 'nbextensions')]
    specs = jupyter_nbextensions_configurator.get_configurable_nbextensions(
        nbextension_dirs=nbextension_dirs)

And what I have on a working version from November of 2022:

__version__ = 0.6.1
def _jupyter_nbextension_paths():
    return [
        dict(
            section="notebook",
            src="static/nbextensions_configurator",
            dest="nbextensions_configurator",
            require='nbextensions_configurator/config_menu/main',
        ),
        dict(
            section="tree",
            src="static/nbextensions_configurator",
            dest="nbextensions_configurator",
            require='nbextensions_configurator/tree_tab/main',
        ),
    ]
```<

@txoof
Copy link
Author

txoof commented Aug 1, 2023

OK, the actual problem is this: I appear to be missing ~/.local/lib/python3.9/site-packages/notebook/base

Looking back at version 6.5.x of jupyter notebook, the base path is included. In version 7.0.1, the base path, along with a shedload of other paths are no longer included.

Is there a sensible workaround for this other than pinning to Notebook 6.5.x?

@txoof txoof changed the title import of jupyter_nbextensions_configurtor fails with ModuleNotFoundError jupyter_contrib_nbextenions appears to be incompatible with Jupyter Notebook v7. Aug 1, 2023
@dotlambda
Copy link

@nesterenkobohdan
Copy link

nesterenkobohdan commented Oct 5, 2023

does anyone know when jupyter_contrib_nbextenions will be compatible with Jupyter Notebook v7 ?

@JackMdata
Copy link

OK, the actual problem is this: I appear to be missing ~/.local/lib/python3.9/site-packages/notebook/base

Looking back at version 6.5.x of jupyter notebook, the base path is included. In version 7.0.1, the base path, along with a shedload of other paths are no longer included.

Is there a sensible workaround for this other than pinning to Notebook 6.5.x?

I'm not as savvy. how can i fix this issue for Notebook v7 or +?

i can't make NBextension work due to this same issue. * withtthe usual pip install or jupyter install commands.
"module not found. notebook.base "

any suggestions?

@WesleyTheGeolien
Copy link

I put a PR together that should fix this and make the package work with notebook 7 if someone could test #1657 and verify the PR works that would be great

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

No branches or pull requests

5 participants