“ ModuleNotFoundError:没有名为'notebook.config_manager'的模块”或“ jupyter笔记本中的内核错误”

时间:2018-10-27 11:35:36

标签: python jupyter-notebook jupyter conda

正如标题中所述,我在conda系统中遇到了jupyter的麻烦。

版本:

  • Ubuntu 16.04 LTS
  • conda 4.3.30
  • jupyter 4.4.0(我已卸载并在出现上述错误后再次安装)

简而言之,我所做的是

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

请注意,在上述操作之前没有问题。


1。 jupyter笔记本出现错误

然后在“ my_env1”中运行jupyter notebook并打开笔记本后,它无法通过以下消息连接内核:

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。在其他conda环境中jupyter命令出错

在另一个表示为“ my_env2”的环境中,诸如jupyter XXX之类的任何命令将因以下错误消息而暂停:

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'

~/.jupyter/jupyter_notebook_config.json中的描述:

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

我为解决该问题所做的事情

但是,以下试验仍未解决。

  • 通过conda重新安装jupyter
  • 禁用nbextension,但由于上述错误而无法正常运行
  • 移走〜/ .jupyter /中的配置文件(检查无济于事后撤消)
  • 从源https://github.com/jupyter/notebook设置jupyter笔记本,但是pip install .返回消息Failed to run bower: [Errno 2] No such file or directory: 'bower': 'bower'(我想知道为什么它需要bower而不尝试)

问题

我的问题很简单:

  • 我该如何解决?

如果缺少信息,请通知我。谢谢。


评论

我以前在同一anaconda3创建的另一个环境(例如my_env3)中使用过nbextension,当时没有问题。

0 个答案:

没有答案