Jupyter内核在Ubuntu上崩溃

6
昨晚我下载了Anaconda,并按照其在Ubuntu下的说明安装了Jupyter。我想要复制一些在普通Python 3.x环境下运行过且也在Jupyter的试用版中运行过的相当简单的Python代码,因此我想这是一个系统问题。
在安装时,我打开了一个Python 3笔记本,最初显示“Kernel Starting please wait..”,然后它显示已经准备好,在几秒钟后说内核已经死亡并且无法重新启动。实际上,它返回了特定的消息“Dead kernel”。 在此之前,我没有输入任何代码。
我认为我已正确安装了所有内容!
我正在运行16.04 LTS。 Python是3.7
我已经检查了其他类似的帖子,但提供的解决方案不适用于此情况。或许这是一些更深层次的问题。
感谢您能提供的任何帮助。
来自Jupyter notebook --debug的输出如下:
peter@xxxx:~$ jupyter notebook --debug
[D 19:45:46.147 NotebookApp] Searching ['/home/peter', '/home/peter/.jupyter', '/home/peter/anaconda3/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[D 19:45:46.149 NotebookApp] Looking for jupyter_config in /etc/jupyter
[D 19:45:46.149 NotebookApp] Looking for jupyter_config in /usr/local/etc/jupyter
[D 19:45:46.150 NotebookApp] Looking for jupyter_config in /home/peter/anaconda3/etc/jupyter
[D 19:45:46.150 NotebookApp] Looking for jupyter_config in /home/peter/.jupyter
[D 19:45:46.150 NotebookApp] Looking for jupyter_config in /home/peter
[D 19:45:46.152 NotebookApp] Looking for jupyter_notebook_config in /etc/jupyter
[D 19:45:46.152 NotebookApp] Looking for jupyter_notebook_config in /usr/local/etc/jupyter
[D 19:45:46.152 NotebookApp] Looking for jupyter_notebook_config in /home/peter/anaconda3/etc/jupyter
[D 19:45:46.153 NotebookApp] Looking for jupyter_notebook_config in /home/peter/.jupyter
[D 19:45:46.153 NotebookApp] Looking for jupyter_notebook_config in /home/peter
[I 19:45:46.644 NotebookApp] Serving notebooks from local directory: /home/peter
[I 19:45:46.644 NotebookApp] 0 active kernels 
[I 19:45:46.644 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=aabe7a1a36a3b0bbeac24f68420aca3996fc05257b13eb85
[I 19:45:46.644 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 19:45:46.651 NotebookApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=aabe7a1a36a3b0bbeac24f68420aca3996fc05257b13eb85
[I 19:45:46.882 NotebookApp] Accepting one-time-token-authenticated connection from 127.0.0.1
[D 19:45:46.885 NotebookApp] Using contents: services/contents
[D 19:45:46.982 NotebookApp] Path base/images/favicon.ico served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/base/images/favicon.ico
[D 19:45:46.982 NotebookApp] Path components/jquery-ui/themes/smoothness/jquery-ui.min.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css
[D 19:45:46.983 NotebookApp] Path components/jquery-typeahead/dist/jquery.typeahead.min.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/jquery-typeahead/dist/jquery.typeahead.min.css
[D 19:45:46.983 NotebookApp] Path style/style.min.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/style/style.min.css
[D 19:45:46.985 NotebookApp] Path components/es6-promise/promise.min.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/es6-promise/promise.min.js
[D 19:45:46.985 NotebookApp] Path components/requirejs/require.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/requirejs/require.js
[D 19:45:46.986 NotebookApp] Path base/images/logo.png served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/base/images/logo.png
[D 19:45:46.987 NotebookApp] Path tree/js/main.min.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/tree/js/main.min.js
[D 19:45:46.993 NotebookApp] 200 GET /tree?token=b921788f87fa7cc313f98e9e4e37a23f005ad3f2e727cc3f (127.0.0.1) 112.57ms
[D 19:45:47.120 NotebookApp] Path custom.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/custom/custom.css
[D 19:45:47.122 NotebookApp] 304 GET /custom/custom.css (127.0.0.1) 3.34ms
[D 19:45:47.499 NotebookApp] Path services/contents.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/services/contents.js
[D 19:45:47.501 NotebookApp] 200 GET /static/services/contents.js?v=20170427194546 (127.0.0.1) 5.54ms
[D 19:45:47.510 NotebookApp] Path custom.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/custom/custom.js
[D 19:45:47.512 NotebookApp] 200 GET /custom/custom.js?v=20170427194546 (127.0.0.1) 3.43ms
[D 19:45:47.585 NotebookApp] 200 GET /api/config/tree?_=1493318747367 (127.0.0.1) 7.78ms
[D 19:45:47.591 NotebookApp] 200 GET /api/config/common?_=1493318747368 (127.0.0.1) 4.54ms
[D 19:45:47.599 NotebookApp] 200 GET /api/terminals?_=1493318747369 (127.0.0.1) 1.57ms
[D 19:45:47.606 NotebookApp] Found kernel python3 in /usr/local/share/jupyter/kernels
[D 19:45:47.607 NotebookApp] Found kernel python3 in /usr/local/share/jupyter/kernels
[D 19:45:47.614 NotebookApp] 304 GET /api/kernelspecs (127.0.0.1) 10.39ms
[D 19:45:47.618 NotebookApp] 200 GET /api/terminals?_=1493318747371 (127.0.0.1) 1.68ms
[D 19:45:47.621 NotebookApp] 200 GET /api/sessions?_=1493318747370 (127.0.0.1) 2.22ms
[D 19:45:47.714 NotebookApp] 200 GET /api/contents?type=directory&_=1493318747372 (127.0.0.1) 40.84ms
[I 19:45:53.598 NotebookApp] Creating new notebook in 
[D 19:45:53.604 NotebookApp] Saving /home/peter/Untitled5.ipynb
[D 19:45:53.939 NotebookApp] 201 POST /api/contents (127.0.0.1) 343.75ms
[D 19:45:53.948 NotebookApp] Using contents: services/contents
[D 19:45:54.008 NotebookApp] Path components/bootstrap-tour/build/css/bootstrap-tour.min.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/bootstrap-tour/build/css/bootstrap-tour.min.css
[D 19:45:54.008 NotebookApp] Path components/codemirror/lib/codemirror.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/codemirror/lib/codemirror.css
[D 19:45:54.009 NotebookApp] Path notebook/css/override.css served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/notebook/css/override.css
[D 19:45:54.010 NotebookApp] Path components/text-encoding/lib/encoding.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/text-encoding/lib/encoding.js
[D 19:45:54.010 NotebookApp] Path notebook/js/main.min.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/notebook/js/main.min.js
[D 19:45:54.016 NotebookApp] 200 GET /notebooks/Untitled5.ipynb?kernel_name=python3 (127.0.0.1) 69.16ms
[D 19:45:54.063 NotebookApp] Path components/MathJax/MathJax.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/MathJax/MathJax.js
[D 19:45:54.064 NotebookApp] 304 GET /static/components/MathJax/MathJax.js?config=TeX-AMS_HTML-full,Safe&delayStartupUntil=configured (127.0.0.1) 2.21ms
[D 19:45:54.067 NotebookApp] 304 GET /custom/custom.css (127.0.0.1) 1.47ms
[D 19:45:54.220 NotebookApp] Path components/MathJax/config/TeX-AMS_HTML-full.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/MathJax/config/TeX-AMS_HTML-full.js
[D 19:45:54.221 NotebookApp] 304 GET /static/components/MathJax/config/TeX-AMS_HTML-full.js?rev=2.6.0 (127.0.0.1) 2.67ms
[D 19:45:54.635 NotebookApp] 304 GET /custom/custom.js?v=20170427194546 (127.0.0.1) 1.61ms
[D 19:45:54.711 NotebookApp] Path components/MathJax/config/Safe.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/MathJax/config/Safe.js
[D 19:45:54.713 NotebookApp] 304 GET /static/components/MathJax/config/Safe.js?rev=2.6.0 (127.0.0.1) 2.84ms
[D 19:45:54.788 NotebookApp] 200 GET /api/config/notebook?_=1493318754418 (127.0.0.1) 8.55ms
[D 19:45:54.795 NotebookApp] 200 GET /api/config/common?_=1493318754419 (127.0.0.1) 5.98ms
[D 19:45:54.918 NotebookApp] Found kernel python3 in /usr/local/share/jupyter/kernels
[D 19:45:54.918 NotebookApp] Found kernel python3 in /usr/local/share/jupyter/kernels
[D 19:45:54.920 NotebookApp] 304 GET /api/kernelspecs (127.0.0.1) 3.39ms
[D 19:45:55.147 NotebookApp] 200 GET /api/contents/Untitled5.ipynb?type=notebook&_=1493318754420 (127.0.0.1) 180.31ms
[D 19:45:55.150 NotebookApp] Path components/MathJax/extensions/Safe.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/MathJax/extensions/Safe.js
[D 19:45:55.151 NotebookApp] 304 GET /static/components/MathJax/extensions/Safe.js?rev=2.6.0 (127.0.0.1) 1.94ms
[D 19:45:55.153 NotebookApp] Path jupyter-js-widgets/extension.js served from /home/peter/anaconda3/share/jupyter/nbextensions/jupyter-js-widgets/extension.js
[D 19:45:55.158 NotebookApp] 200 GET /nbextensions/jupyter-js-widgets/extension.js?v=20170427194546 (127.0.0.1) 5.83ms
[D 19:45:55.160 NotebookApp] Path components/MathJax/jax/output/HTML-CSS/fonts/STIX-Web/fontdata.js served from /home/peter/anaconda3/lib/python3.6/site-packages/notebook/static/components/MathJax/jax/output/HTML-CSS/fonts/STIX-Web/fontdata.js
[D 19:45:55.161 NotebookApp] 304 GET /static/components/MathJax/jax/output/HTML-CSS/fonts/STIX-Web/fontdata.js?rev=2.6.0 (127.0.0.1) 2.33ms
[D 19:45:55.372 NotebookApp] Found kernel python3 in /usr/local/share/jupyter/kernels
[D 19:45:55.374 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-de446353-af9d-4b59-bfc1-a8cdb4572ac4.json']
[D 19:45:55.387 NotebookApp] Connecting to: tcp://127.0.0.1:39311
[I 19:45:55.389 NotebookApp] Kernel started: de446353-af9d-4b59-bfc1-a8cdb4572ac4
[D 19:45:55.390 NotebookApp] Kernel args: {'kernel_name': 'python3', 'cwd': '/home/peter'}
[D 19:45:55.393 NotebookApp] 201 POST /api/sessions (127.0.0.1) 44.08ms
[D 19:45:55.398 NotebookApp] 200 GET /api/contents/Untitled5.ipynb/checkpoints?_=1493318754421 (127.0.0.1) 3.89ms
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[D 19:45:55.554 NotebookApp] Initializing websocket connection /api/kernels/de446353-af9d-4b59-bfc1-a8cdb4572ac4/channels
[D 19:45:55.564 NotebookApp] Requesting kernel info from de446353-af9d-4b59-bfc1-a8cdb4572ac4
[D 19:45:55.565 NotebookApp] Connecting to: tcp://127.0.0.1:49900
[I 19:45:58.388 NotebookApp] KernelRestarter: restarting kernel (1/5)
[D 19:45:58.390 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-de446353-af9d-4b59-bfc1-a8cdb4572ac4.json']
[D 19:45:58.397 NotebookApp] Connecting to: tcp://127.0.0.1:39311
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[I 19:46:01.397 NotebookApp] KernelRestarter: restarting kernel (2/5)
[D 19:46:01.399 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-de446353-af9d-4b59-bfc1-a8cdb4572ac4.json']
[D 19:46:01.407 NotebookApp] Connecting to: tcp://127.0.0.1:39311
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[I 19:46:04.409 NotebookApp] KernelRestarter: restarting kernel (3/5)
[D 19:46:04.411 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-de446353-af9d-4b59-bfc1-a8cdb4572ac4.json']
[D 19:46:04.421 NotebookApp] Connecting to: tcp://127.0.0.1:39311
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[W 19:46:05.568 NotebookApp] Timeout waiting for kernel_info reply from de446353-af9d-4b59-bfc1-a8cdb4572ac4
[D 19:46:05.571 NotebookApp] Opening websocket /api/kernels/de446353-af9d-4b59-bfc1-a8cdb4572ac4/channels
[D 19:46:05.571 NotebookApp] Connecting to: tcp://127.0.0.1:49900
[D 19:46:05.572 NotebookApp] Connecting to: tcp://127.0.0.1:52325
[D 19:46:05.573 NotebookApp] Connecting to: tcp://127.0.0.1:38447
[I 19:46:07.423 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel de446353-af9d-4b59-bfc1-a8cdb4572ac4 restarted
[D 19:46:07.426 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-de446353-af9d-4b59-bfc1-a8cdb4572ac4.json']
[D 19:46:07.435 NotebookApp] Connecting to: tcp://127.0.0.1:39311
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[W 19:46:10.438 NotebookApp] KernelRestarter: restart failed
[W 19:46:10.438 NotebookApp] Kernel de446353-af9d-4b59-bfc1-a8cdb4572ac4 died, removing from map.
ERROR:root:kernel de446353-af9d-4b59-bfc1-a8cdb4572ac4 restarted failed!
[D 19:46:10.476 NotebookApp] Websocket closed de446353-af9d-4b59-bfc1-a8cdb4572ac4:3D6BAC1FF1694B3B8331E3A303569344
[W 19:46:10.482 NotebookApp] Kernel deleted before session
[W 19:46:10.483 NotebookApp] 410 DELETE /api/sessions/9710cac7-54ef-461d-a3b4-acbfcf981ce8 (127.0.0.1) 3.52ms referer=http://localhost:8888/notebooks/Untitled5.ipynb?kernel_name=python3
[W 19:46:16.663 NotebookApp] Session not found: session_id='9710cac7-54ef-461d-a3b4-acbfcf981ce8'
[W 19:46:16.664 NotebookApp] 404 DELETE /api/sessions/9710cac7-54ef-461d-a3b4-acbfcf981ce8 (127.0.0.1) 2.51ms referer=http://localhost:8888/notebooks/Untitled5.ipynb?kernel_name=python3
[D 19:46:16.712 NotebookApp] Found kernel python3 in /usr/local/share/jupyter/kernels
[D 19:46:16.714 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-fb22aad0-0e7c-42c5-b026-1e25ecf89439.json']
[D 19:46:16.723 NotebookApp] Connecting to: tcp://127.0.0.1:55773
[I 19:46:16.725 NotebookApp] Kernel started: fb22aad0-0e7c-42c5-b026-1e25ecf89439
[D 19:46:16.725 NotebookApp] Kernel args: {'kernel_name': 'python3', 'cwd': '/home/peter'}
[D 19:46:16.727 NotebookApp] 201 POST /api/sessions (127.0.0.1) 23.69ms
[D 19:46:16.766 NotebookApp] Initializing websocket connection /api/kernels/fb22aad0-0e7c-42c5-b026-1e25ecf89439/channels
[D 19:46:16.771 NotebookApp] Requesting kernel info from fb22aad0-0e7c-42c5-b026-1e25ecf89439
[D 19:46:16.771 NotebookApp] Connecting to: tcp://127.0.0.1:36903
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[I 19:46:19.726 NotebookApp] KernelRestarter: restarting kernel (1/5)
[D 19:46:19.728 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-fb22aad0-0e7c-42c5-b026-1e25ecf89439.json']
[D 19:46:19.739 NotebookApp] Connecting to: tcp://127.0.0.1:55773
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[I 19:46:22.742 NotebookApp] KernelRestarter: restarting kernel (2/5)
[D 19:46:22.744 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-fb22aad0-0e7c-42c5-b026-1e25ecf89439.json']
[D 19:46:22.753 NotebookApp] Connecting to: tcp://127.0.0.1:55773
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[I 19:46:25.756 NotebookApp] KernelRestarter: restarting kernel (3/5)
[D 19:46:25.758 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-fb22aad0-0e7c-42c5-b026-1e25ecf89439.json']
[D 19:46:25.767 NotebookApp] Connecting to: tcp://127.0.0.1:55773
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[W 19:46:26.773 NotebookApp] Timeout waiting for kernel_info reply from fb22aad0-0e7c-42c5-b026-1e25ecf89439
[D 19:46:26.775 NotebookApp] Opening websocket /api/kernels/fb22aad0-0e7c-42c5-b026-1e25ecf89439/channels
[D 19:46:26.776 NotebookApp] Connecting to: tcp://127.0.0.1:36903
[D 19:46:26.777 NotebookApp] Connecting to: tcp://127.0.0.1:53792
[D 19:46:26.778 NotebookApp] Connecting to: tcp://127.0.0.1:44277
[I 19:46:28.769 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel fb22aad0-0e7c-42c5-b026-1e25ecf89439 restarted
[D 19:46:28.772 NotebookApp] Starting kernel: ['python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-fb22aad0-0e7c-42c5-b026-1e25ecf89439.json']
[D 19:46:28.781 NotebookApp] Connecting to: tcp://127.0.0.1:55773
/home/peter/anaconda3/bin/python: No module named ipykernel_launcher
[W 19:46:31.784 NotebookApp] KernelRestarter: restart failed
[W 19:46:31.785 NotebookApp] Kernel fb22aad0-0e7c-42c5-b026-1e25ecf89439 died, removing from map.
ERROR:root:kernel fb22aad0-0e7c-42c5-b026-1e25ecf89439 restarted failed!
[D 19:46:31.843 NotebookApp] Websocket closed fb22aad0-0e7c-42c5-b026-1e25ecf89439:3D6BAC1FF1694B3B8331E3A303569344
[W 19:46:31.849 NotebookApp] Kernel deleted before session
[W 19:46:31.851 NotebookApp] 410 DELETE /api/sessions/f6a1b60a-6b90-4fd3-8166-b3de0d35cf74 (127.0.0.1) 4.29ms referer=http://localhost:8888/notebooks/Untitled5.ipynb?kernel_name=python3
^C[I 19:46:51.302 NotebookApp] interrupted
Serving notebooks from local directory: /home/peter
0 active kernels 
The Jupyter Notebook is running at: http://localhost:8888/?token=aabe7a1a36a3b0bbeac24f68420aca3996fc05257b13eb85
Shutdown this notebook server (y/[n])? yNo answer for 5s: resuming operation...
y
^C[I 19:47:12.400 NotebookApp] interrupted
Serving notebooks from local directory: /home/peter
0 active kernels 
The Jupyter Notebook is running at: http://localhost:8888/?token=aabe7a1a36a3b0bbeac24f68420aca3996fc05257b13eb85
Shutdown this notebook server (y/[n])? y
[C 19:47:14.911 NotebookApp] Shutdown confirmed
[I 19:47:14.912 NotebookApp] Shutting down kernels
peter@xxxx:~$ 

我尝试按照Yonti的建议去做,但是对我来说并没有起作用,所以我进行了一次干净的安装。这样就解决了我的问题: - PeterDz
应该添加:"Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (默认值,2016年12月23日,12:22:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]" - PeterDz
3个回答

10

我在Ubuntu 14.04上遇到了同样的问题。

通过升级ipykernel解决了这个问题。

sudo pip install --upgrade ipykernel

1
解决了问题。 - Ahmet
如此简单,如此有效 :) - roschach

1
最后,安装Jupyter笔记本给我带来了很多问题,我进行了完整的重建和重新安装Jupyter,并确保我有一个“干净”的Python 2.7内核(存在许多不兼容性)。但是,经过所有这些处理之后,它运行良好。
我建议任何尝试安装Jupyter Notebook并发现内核错误的人都应该查看已安装内核和Jupyter本身的状态。这可能不是唯一阻碍你的问题,但...

0
如果您在浏览器上打开Jupyter时无法连接Python,并且在新选项中看不到Python,请尝试在浏览器上允许cookies。

真的不明白为什么。你能解释一下吗? - PeterDz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接