问题描述
我可以毫无问题地打开Jupyter控制台,但是当我创建一个新的笔记本时,它会一直连接到内核并与内核断开连接(连接到内核/已连接消息一直显示在右上角) 。这就是Chrome的控制台吐出来的(在Firefox中也是如此):
Untitled3.ipynb?kernel_name = python3:121加载自定义.js
default.js:加载了单元格元数据编辑的48Default扩展名。
rawcell.js:82Raw单元格格式工具栏预设已加载。
slideshow.js:43Slideshow加载元数据编辑的扩展名。
menubar.js:240actions jupyter-notebook:find-and-replace不存在,仍然绑定它以防以后定义...
MenuBar.bind_events @ menubar.js:240
extension.js无法加载资源:服务器响应状态为404(未找到)
main.js:184Widgets不可用。请安装widgetsnbextension或ipywidgets 4.0
(匿名)@main.js:184
session.js:54Session:kernel_created(1b236a4b-902d-4b33-9118-63013be4f270)
kernel.js:456Starting WebSockets:ws:// [myipaddress]:[myport] / api / kernels / 682dc980-d7c6-41e0-b984-14ceb7f8e50c
kernel.js:101Kernel:kernel_connected(682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:101内核:kernel_disconnected(682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:559连接丢失,在1秒内重新连接。
kernel.js:101内核:kernel_reconnecting(682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:456启动WebSockets:ws:// [myipaddress]:[myport] / api / kernels / 682dc980 -d7c6-41e0-b984-14ceb7f8e50c
kernel.js:101内核:kernel_connected(682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:101内核:kernel_disconnected(682dc980-d7c6-41e0-b984- 14ceb7f8e50c)
kernel.js:559连接丢失,在1秒内重新连接。
kernel.js:101内核:kernel_reconnecting(682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:456启动WebSockets:ws:// [myipaddress]:[myport] / api / kernels / 682dc980 -d7c6-41e0-b984-14ceb7f8e50c
kernel.js:101内核:kernel_connected(682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:101内核:kernel_disconnected(682dc980-d7c6-41e0-b984- 14ceb7f8e50c)
kernel.js:559连接丢失,在1秒内重新连接。
#...更多相同,一遍又一遍......#
事情是的,当我在运行Jupyter服务器的同一台机器上创建一个笔记本时,一切正常(我留在家里的MacBook)。当我从另一台机器(我在公司使用的运行Windows的PC)上创建笔记本时,会出现问题。可能会发生什么?
我刚刚将端口从8888更改为9999,问题就消失了。
jupyter notebook --generate-config
(它表示生成的配置文件在哪里)
生成配置文件,然后找到行
c.NotebookApp.port
并更改端口。
I get to open the Jupyter console without any problems, but when I create a new notebook it keeps connecting to and disconnecting from the kernel (the messages "Connecting to Kernel" / "Connected" keep showing in the upper right corner). This is what Chrome's console spits out (it's the same in Firefox):
Untitled3.ipynb?kernel_name=python3:121 loaded custom.js
default.js:48Default extension for cell metadata editing loaded.
rawcell.js:82Raw Cell Format toolbar preset loaded.
slideshow.js:43Slideshow extension for metadata editing loaded.
menubar.js:240actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
MenuBar.bind_events @ menubar.js:240
extension.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js:184Widgets are not available. Please install widgetsnbextension or ipywidgets 4.0
(anonymous) @ main.js:184
session.js:54Session: kernel_created (1b236a4b-902d-4b33-9118-63013be4f270)
kernel.js:456Starting WebSockets: ws://[myipaddress]:[myport]/api/kernels/682dc980-d7c6-41e0-b984-14ceb7f8e50c
kernel.js:101Kernel: kernel_connected (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:101Kernel: kernel_disconnected (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:559Connection lost, reconnecting in 1 seconds.
kernel.js:101Kernel: kernel_reconnecting (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:456Starting WebSockets: ws://[myipaddress]:[myport]/api/kernels/682dc980-d7c6-41e0-b984-14ceb7f8e50c
kernel.js:101Kernel: kernel_connected (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:101Kernel: kernel_disconnected (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:559Connection lost, reconnecting in 1 seconds.
kernel.js:101Kernel: kernel_reconnecting (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:456Starting WebSockets: ws://[myipaddress]:[myport]/api/kernels/682dc980-d7c6-41e0-b984-14ceb7f8e50c
kernel.js:101Kernel: kernel_connected (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:101Kernel: kernel_disconnected (682dc980-d7c6-41e0-b984-14ceb7f8e50c)
kernel.js:559Connection lost, reconnecting in 1 seconds.
# ... more of the same, over and over ... #
Thing is, everything works fine when I create a notebook on the same machine that runs the Jupyter server (a MacBook I keep at home). The problem happens when I create a notebook from a different machine (a PC running Windows that I use at my company). What could be going on?
I've just changed the port from 8888 to 9999, and the problem is gone.
use the command
jupyter notebook --generate-config
(it says where the generated config file is)
to generate a config file, then find the line
c.NotebookApp.port
and change the port.
这篇关于Jupyter笔记本不断重新连接到内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!