Search code examples
pythonjupyterjupyter-labjupyterhub

JupyterHub fails to spawn new session with 'No module named IPythonHandler'


I am using the jupyterhub 1.4 Docker image and have set it up to spawn sessions with sudospawner-singleuser. However I now get the following error when a user tries to log in:

AttributeError: module 'notebook.base.handlers' has no attribute 'IPythonHandler'

The setup used to work but started to fail after I restarted my container. I also tried the 1.5 image and got the same error, both with the following stack trace:

 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/dist-packages/traitlets/utils/importstring.py", line 32, in import_item
     pak = getattr(module, obj)
 AttributeError: module 'notebook.base.handlers' has no attribute 'IPythonHandler'

 During handling of the above exception, another exception occurred:
 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/dist-packages/jupyterlab/labhubapp.py", line 19, in <module>
     from jupyterhub.singleuser.mixins import make_singleuser_app
   File "/usr/local/lib/python3.9/dist-packages/jupyterhub/singleuser/__init__.py", line 5, in <module>
     from .app import main
   File "/usr/local/lib/python3.9/dist-packages/jupyterhub/singleuser/app.py", line 41, in <module>
     SingleUserNotebookApp = make_singleuser_app(App)
   File "/usr/local/lib/python3.9/dist-packages/jupyterhub/singleuser/mixins.py", line 916, in make_singleuser_app
     BaseHandler = _patch_app_base_handlers(empty_parent_app)
   File "/usr/local/lib/python3.9/dist-packages/jupyterhub/singleuser/mixins.py", line 871, in _patch_app_base_handlers
     base_handlers.append(import_item(base_handler_name))
   File "/usr/local/lib/python3.9/dist-packages/traitlets/utils/importstring.py", line 34, in import_item
     raise ImportError("No module named %s" % obj)
 ImportError: No module named IPythonHandler

Any idea why this is now happening and how I can fix it?


Solution

  • Try downgrading module nbclassic to 0.3.7 and restart jupyterhub server

    pip install nbclassic==0.3.7