"ModuleNotFoundError: No module named 'notebook.config_manager'" or "kernel error in the jupyter notebook"

2k Views Asked by At

I encoutered the trouble with the jupyter in the conda system as in the title.

version:

  • Ubuntu 16.04 LTS
  • conda 4.3.30
  • jupyter 4.4.0 (I've uninstall and then install again after the above error)

What I've done is following (in short)

source activate my_env1

pip install jupyter_contrib_nbextensions
# (I'm aware that I should have used conda install...)
jupyter contrib nbextension install --user
jupyter nbextension enable codefolding/main
jupyter contrib nbextensions migrate

pip install RISE
jupyter-nbextension install rise --py --sys-prefix
jupyter-nbextension enable rise --py --sys-prefix

Notice that no problem happens before the above.


1. Error at the jupyter notebook

Then after running jupyter notebook in "my_env1" and openning a notebook, it fails to connect the kernel with the following message:

ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
  File "***my_env1***/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "***my_env1***/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "***my_env1***/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "***my_env1***/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    self.pre_handler_hook()
  File "**  *my_env1***/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
  File "***my_env1***/lib/python3.6/signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread

2. Error with the jupyter command in other conda environment

In an other environment denoted "my_env2", any command like jupyter XXX halts with the following error message:

Traceback (most recent call last):
  File "***my_env2***/bin/jupyter-notebook", line 4, in <module>
    import notebook.notebookapp
  File "***my_env2***/lib/python3.6/site-packages/notebook/__init__.py", line 25, in <module>
    from .nbextensions import install_nbextension
  File "***my_env2***/lib/python3.6/site-packages/notebook/nbextensions.py", line 31, in <module>
    from .config_manager import BaseJSONConfigManager
ModuleNotFoundError: No module named 'notebook.config_manager'

The desciprion in ~/.jupyter/jupyter_notebook_config.json :

{                                                                               
  "NotebookApp": {
    "nbserver_extensions": {
      "nbpresent": true,
      "jupyter_nbextensions_configurator": true
    }   
  }
} 

What I did to resolve it

The following trials didn't resolve, however.

  • reinstall jupyter via conda
  • disable nbextension but it didn't work due to the above error
  • move away the config files in ~/.jupyter/ (and undo after checking it didn't help)
  • setup jupyter notebook from the source https://github.com/jupyter/notebook but pip install . returns the message Failed to run bower: [Errno 2] No such file or directory: 'bower': 'bower' (I wonder why it requires bower and not try it)

Question

My qustion is so simple :

  • How can I resolve it ?

If there is lack of information, please inform me. Thank you.


Comment

I've used the nbextension in another environment (to say, my_env3) created by the same anaconda3 before and got no problem at that time.

0

There are 0 best solutions below