1

如标题所示,我在 conda 系统中遇到了 jupyter 的问题。

版本:

  • Ubuntu 16.04 LTS
  • 康达 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 notebook 报错

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

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 notebook但pip install .返回消息Failed to run bower: [Errno 2] No such file or directory: 'bower': 'bower'(我想知道为什么它需要bower而不是尝试)

问题

我的问题很简单:

  • 我该如何解决?

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


评论

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

4

0 回答 0