繁体   English   中英

内核在 jupyter 笔记本中不断死亡

[英]kernel keeps dying in jupyter notebook

每当我启动 jupyter notebook 并创建一个新的 python 3 notebook 时,我都会收到一条错误消息,说内核已经死了。 我已经尝试删除和安装 ipython、python3.6.5 和 jupyter notebook,但我仍然收到错误消息。

我的 cmd 屏幕如下:-

[I 06:46:36.432 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
WARNING:root:kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 restarted
Traceback (most recent call last):

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\__init__.py", line 55, in <module>
    from .terminal.embed import embed

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\terminal\embed.py", line 17, in <module>
    from IPython.terminal.ipapp import load_default_config

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\terminal\ipapp.py", line 34, in <module>
    from IPython.extensions.storemagic import StoreMagics

**ModuleNotFoundError: No module named 'IPython.extensions'**

[W 06:46:39.450 NotebookApp] KernelRestarter: restart failed

[W 06:46:39.450 NotebookApp] Kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 died, removing from map.

ERROR:root:kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 restarted failed!
[W 06:46:39.461 NotebookApp] 410 DELETE /api/sessions/67987236-8755-433a-afcb-e052ccbf65b9 (::1): Kernel deleted before session

**[W 06:46:39.461 NotebookApp] Kernel deleted before session**

[W 06:46:39.461 NotebookApp] 410 DELETE /api/sessions/67987236-8755-433a-afcb-e052ccbf65b9 (::1) 1.00ms 

referer=http://localhost:8888/notebooks/Untitled5.ipynb?kernel_name=python3## Heading ##

您可以尝试重新安装 Jupyter,

pip uninstall jupyter
pip install jupyter

然后再试一次,这在我的情况下有效。 当我升级到 Ubuntu 18.04 时遇到了这个问题。

也检查这个线程。 https://github.com/jupyter/notebook/issues/1892

确定 jupyter notebook 内核为什么会死掉有时可能会令人生畏。 当内核因库问题而死机时,您可能无法获得有关导致它的原因的任何反馈。 尝试在终端或 ipython 中运行导致内核死亡的代码。 我发现的一个常见问题是在更高版本的 tensorflow 中使用 SSE4.1,这会导致此错误: TensorFlow library was compiled to use SSE4.1 instructions, but these aren't available on your machine. Aborted (core dumped) TensorFlow library was compiled to use SSE4.1 instructions, but these aren't available on your machine. Aborted (core dumped) 如果您在代码中使用 tensorflow 并且在 notebook 中不显示任何错误,这将导致内核死亡。 如果是这种情况,请卸载 tensorflow 并使用 conda 进行安装:例如conda install tensorflow==1.12.0

与您的问题不完全相同,但是我发现当我使用

exit()

命令在我的一种类方法中。 删除这个 exit() 命令阻止了我的内核死亡。

如果有内核备份,这也可能发生。 我关闭了服务器,它告诉我关闭了 4 个内核。 显然我有一些旧的失控内核。 当我重新启动服务器时,创建了一个新的内核,我又开始工作了。

好吧,我遇到了同样的问题,但是当我使用 matplotlib 并尝试绘制库时,我在使用 spyder 时遇到了同样的问题。 猜测尝试更新库应该可以解决它。 通过 Anaconda 使用 Jupyter,也可能是 anaconda 问题。

请尝试卸载所有:

  • 内核
  • 蟒蛇
  • jupyter_client
  • jupyter_core
  • 性状
  • ipython_genutils

然后再次安装。

在尝试了许多其他解决方案后,它对我有用。 实际上,库冲突的问题导致了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM