代码之家  ›  专栏  ›  技术社区  ›  default_settings

Anaconda更新后Jupyter笔记本死机内核

  •  3
  • default_settings  · 技术社区  · 6 年前

    我遇到了以下问题。更新Anaconda后,因为导入skimage时出错。在Jupyter Notebook中的一个项目中,io出现了一个更大的错误—内核死机。目前,我无法启动项目,因为Jupyter给出的错误如下:

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/? 
    token=aaf85a5e18489792c87cce65d7a53a0263cd5c08cc7248b 6
    [I 00:55:13.451 NotebookApp] Accepting one-time-token-authenticated 
    connection from ::1
    [I 00:55:31.607 NotebookApp] Kernel started: 608d2190-59e6-4888-b09a- 
    e616f67bd5b4
    Traceback (most recent call last):
    ERROR:tornado.general:Uncaught exception in ZMQStream callback
    Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\tornado\stack_context.py", line 276, in null_wrapper
    return fn(*args, **kwargs)
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", 
    line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", 
    line 233, in dispatch_shell
    self.pre_handler_hook()
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", 
    line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
    File "C:\Program Files\Anaconda3\lib\signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
    ValueError: signal only works in main thread  File "C:\Program 
    Files\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
    
    File "C:\Program Files\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel_launcher.py", 
    line 16, in <module>
    app.launch_new_instance()
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", 
    line 477, in start
    ioloop.IOLoop.instance().start()
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\tornado\platform\asyncio.py", line 112, in start
    self.asyncio_loop.run_forever()
    ERROR:tornado.general:Uncaught exception in zmqstream callback
    Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\zmq\eventloop\zmqstream.py", line 450, in _handle_events
    self._handle_recv()
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv
    self._run_callback(callback, msg)
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
    File "C:\Program Files\Anaconda3\lib\site- 
    packages\tornado\stack_context.py", line 276, in null_wrapper
    return fn(*args, **kwargs)
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", 
    line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", 
    line 233, in dispatch_shell
    self.pre_handler_hook()
    File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", 
    line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
    File "C:\Program Files\Anaconda3\lib\signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
    ValueError: signal only works in main thread  File "C:\Program   
    Files\Anaconda3\lib\asyncio\base_events.py", line 409, in run_forever
    
    10 回复  |  直到 6 年前
        1
  •  10
  •   anothernode David Joel Lukombo    6 年前

    以下程序包是 全新的 安装jupyter笔记本电脑(5.6版),带有 conda ,因此 tornado is 5.1。

    ipykernel:          4.8.2-py36_0       conda-forge
    ipywidgets:         7.4.0-py_0         conda-forge
    jupyter:            1.0.0-py_1         conda-forge
    jupyter_client:     5.2.3-py_1         conda-forge
    jupyter_console:    5.2.0-py36_0       conda-forge
    nbconvert:          5.3.1-py_1         conda-forge
    notebook:           5.6.0-py36_0       conda-forge
    qtconsole:          4.3.1-py36_0       conda-forge
    terminado:          0.8.1-py36_0       conda-forge
    tornado:            5.1-py36h470a237_1 conda-forge
    widgetsnbextension: 3.4.0-py36_0       conda-forge
    

    要解决此问题,可以手动安装最新版本的 龙卷风 :

    conda install tornado --update
    

    或者从头开始重新安装jupyter笔记本:

    conda uninstall jupyter tornado
    conda install jupyter
    
        2
  •  8
  •   Azhar Khan Chirag Dave    2 年前

    对我来说,这个问题 ipykernel 版本不匹配。我已安装 google-colab 这降低了我的 ipykernel公司 。卸载后 谷歌colab 和升级 ipykernel公司 到目前为止,问题已经解决了。

    pip uninstall google-colab

    pip install --upgrade ipykernel

        3
  •  4
  •   Stephen Kennedy annamataws    6 年前

    升级ipykernel对我有用

    conda upgrade ipykernel
    
        4
  •  1
  •   default_settings    6 年前

    在尝试了很多“快速修复”(卸载和安装Jupyter软件包等)之后,唯一的方法就是从一开始就卸载和安装Anaconda。如果您不怕从头开始安装所有软件包(在我的情况下没有必要),那么这个解决方案是最好的。

        5
  •  1
  •   ROHIT GHOSH    6 年前

    我认为这里的问题是因为tornado版本不匹配。你应该降级到旧版本的tornado来解决这个问题。至少,这对我起了作用。这应该可以奏效。

    conda install tornado=4.5.3 
    
        6
  •  0
  •   Simbarashe Timothy Motsi clayton.nichols    6 年前

    我在使用Jupyter实验室时也遇到了问题,我用命令升级了版本。
    pip install jupyterlab —upgrade
    避免在系统范围内安装
    pip install jupyterlab —upgrade —user

        7
  •  0
  •   ashish saxena    4 年前

    在尝试各种解决方案、升级和降级各种依赖项之后 conda upgrade --all 为我工作。

        8
  •  0
  •   paul xiong    4 年前

    conda升级--对我来说一切正常

        9
  •  0
  •   cdutra    4 年前

    只有

    python -m ipykernel install --user

    python3 -m ipykernel install --user

    在这里工作。

        10
  •  0
  •   William Le    2 年前

    如果您在Vscode中使用Jupyter笔记本,

    卸载所有conda软件包

    安装Anaconda Clean以移除conda软件包

    conda install anaconda-clean
    

    这将删除您的所有conda软件包

    anaconda-clean --yes
    

    然后卸载Vscode中的Jupyter扩展,关闭当前的Jupyter notebook选项卡,重新打开Jupyter notebook文件,运行它并在Vscode中的弹出窗口中重新安装Jupyter。

    这对我有用。