No module named 'notebook.services'

I have just upgraded jupyter under python 3.12 with pip
IPython : 8.26.0
ipykernel : 6.29.5
ipywidgets : 8.1.3
jupyter_client : 8.6.2
jupyter_core : 5.7.2
jupyter_server : 2.14.2
jupyterlab : 4.2.4
nbclient : 0.10.0
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.2.1
qtconsole : 5.5.2
traitlets : 5.14.3

when I open jupyter or jupyter lab

I get:

from notebook.services.config import ConfigManager
ModuleNotFoundError: No module named 'notebook.services

this has been going on a long time and I can’t find much on the web.

thanks in advance

1 Like

It looks like some server extension is expecting notebook v6, but you have notebook v7.

In general a few of the versions listed are pretty outdated, maybe you upgraded just one of the packages but not all of them? By upgrading jupyter what do you mean precisely (what command did you use)?

What does pip check show?

2 Likes

thanks for looking into this.
It turns out that I was using a venv and modules were being imported from a system wide python installation.
solved that by going to a somewhat different linux distribution
thanks again

1 Like

Running into the same issue, in my case, caused by

jupyter nbconvert --execute --to html sample.ipynb
  File "/home/path/to/env/lib/python3.10/site-packages/jupyter_contrib_nbextensions/nbconvert_support/collapsible_headings.py", line 6, in <module>
    from notebook.services.config import ConfigManager
ModuleNotFoundError: No module named 'notebook.services'

No combination of versions between nbconvert and jupyter_contrib_nbextensions seemed to work, but uninstalling the latter fixed the problem.

I ran into the same issue recently and found this from ChatGPT –

My web search confirms the ModuleNotFoundError is a notebook versioning issue. It seems notebook 7+ is incompatible with other Jupyter components. I’ll downgrade notebook to a 6.x version, specifically 6.5.4, and align jupyter dependencies to resolve this.

pip install "notebook<7" jupyter

It worked very well :raising_hands:

Is there some reason you need version 6 to keep using older stuff? If so, you may also want to look into NbClassic.

If you don’t need old versions and extensions, you may want to consider cleanly updating to the current version of Jupyter Notebook. I suspect the issue was you updated partially and were getting conflicts with things left behind.

NbClassic is the more up-to-date way to support the older extensions and things, see here. (I think you would also need to clean things out better though if you plan to go that route.)

However, if you are not looking to be that thorough at this time, and are content with things working on your machine for now, it may be worth continuing on with what you have until you have a new system.