内核不断死在jupyter笔记本中
每当我启动jupyter笔记本并创建一个新的python 3笔记本时,我都会收到一条错误消息,指出内核已死亡. 我尝试删除并安装ipython,python3.6.5和jupyter笔记本,但仍然收到错误消息.
Whenever I start jupyter notebook and create a new python 3 notebook I get an error message saying kernel has died. I have tried deleting and installing ipython, python3.6.5, and jupyter notebook but I still get the error message.
我的cmd屏幕如下:-
My cmd screen is as follows:-
[I 06:46:36.432 NotebookApp] KernelRestarter:重新启动内核(4/5),新的随机端口 警告:root:kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2重新启动 追溯(最近一次通话):
[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):
_run_module_as_main中的文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ runpy.py",第193行 "主要",mod_spec)
File "c:\users\user\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec)
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ runpy.py",第85行,使用_run_code exec(代码,run_globals)
File "c:\users\user\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals)
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ site-packages \ ipykernel_launcher.py",第15行,在 从ipykernel导入kernelapp作为应用程序
File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ site-packages \ ipykernel__init __.py",第2行,在 从.connect import *
File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel__init__.py", line 2, in from .connect import *
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ site-packages \ ipykernel \ connect.py",第13行,在 从IPython.core.profiledir导入ProfileDir
File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel\connect.py", line 13, in from IPython.core.profiledir import ProfileDir
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ site-packages \ IPython__init __.py",第55行,在 从.terminal.embed导入嵌入
File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython__init__.py", line 55, in from .terminal.embed import embed
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ site-packages \ IPython \ terminal \ embed.py",第17行,在 从IPython.terminal.ipapp导入load_default_config
File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\terminal\embed.py", line 17, in from IPython.terminal.ipapp import load_default_config
文件"c:\ users \ user \ appdata \ local \ programs \ python \ python36-32 \ lib \ site-packages \ IPython \ terminal \ ipapp.py",第34行,在 从IPython.extensions.storemagic导入StoreMagics
File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\terminal\ipapp.py", line 34, in from IPython.extensions.storemagic import StoreMagics
ModuleNotFoundError:没有名为"IPython.extensions"的模块
[W 06:46:39.450 NotebookApp] KernelRestarter:重新启动失败
[W 06:46:39.450 NotebookApp] KernelRestarter: restart failed
[W 06:46:39.450 NotebookApp]内核0d0442a9-c92f-46e6-acdd-08ca0a18c5f2死亡,已从地图中删除.
[W 06:46:39.450 NotebookApp] Kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 died, removing from map.
错误:root:内核0d0442a9-c92f-46e6-acdd-08ca0a18c5f2重新启动失败! [W 06:46:39.461 NotebookApp] 410删除/api/sessions/67987236-8755-433a-afcb-e052ccbf65b9(:: 1):会话前删除内核
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]会话之前删除内核
[W 06:46:39.461 NotebookApp] 410删除/api/sessions/67987236-8755-433a-afcb-e052ccbf65b9(:: 1)1.00ms
[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 ## 标题##
referer=http://localhost:8888/notebooks/Untitled5.ipynb?kernel_name=python3## Heading ##
确定为什么jupyter笔记本内核死亡有时会令人生畏.当内核由于库问题而死时,您可能不会得到任何有关导致它的原因的反馈.尝试运行导致内核在终端或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并使用conda安装:
例如,conda install tensorflow==1.12.0
.
Determining why jupyter notebook kernel dies can be daunting sometimes. When kernel dies as a result of library issues, you might not get any feedback as to what is causing it. Try running the code that is causing the kernel to die in a terminal or in ipython. One common issue I have identified is the use of SSE4.1 in later versions of tensorflow, which gives this error:
TensorFlow library was compiled to use SSE4.1 instructions, but these aren't available on your machine. Aborted (core dumped)
. This will cause the kernel to die if you are using tensorflow in your code and not display any error in notebook. If this is the case, uninstall tensorflow and install with conda:
conda install tensorflow==1.12.0
, for instance.