Jupyter笔记本内核未连接 [英] Jupyter notebook kernel not connecting

查看:1162
本文介绍了Jupyter笔记本内核未连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前在Mac上使用过Jupyter Notebook(python 2和3).一段时间不使用后,似乎无法解决问题.使用命令Jupyter notebook从终端启动笔记本电脑,然后选择要使用的笔记本电脑时,出现错误:

I have previously used Jupyter Notebook (python 2 and 3) on my mac. After not using it for a while, there seems to be a problem I am unable to fix. When starting the notebook from terminal using the command Jupyter notebook, and then select a notebook I want to work with, I get the error:

"A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration."

我很肯定这与我的Internet连接无关(我已经尝试将两台计算机连接到不同的网络).

I am positive this has nothing to do with my internet connection (I have tried 2 machines connected to different networks).

我已经阅读到浏览器可能是问题所在,因此我已经安装了Chrome和Firefox.但是,当我使用Safari,Chrome和Firefox时,出现此错误.

I have read that the browser could be the problem, therefore I have installed Chrome and Firefox. However, I get this error when I am using Safari, Chrome, and Firefox.

然后,我了解到这是一个代理问题.我试图将笔记本的服务器地址添加到我的mac的高级网络首选项和Firefox上的高级设置的No proxy fields中.

Then I read about it being a proxy issue. I have tried to add the server address of the notebook to the No proxy fields of the advanced network preferences of my mac, and of the advanced setting on Firefox.

我唯一能想到的是我输入了错误的服务器地址?

The only thing I can think of is that I am entering the wrong server address?

我一般对设置和错误了解不多,希望有人可以为我提供一些替代选择,以使Jupyter再次工作.

I do not know much about setting and errors in general, hopefully someone can provide me with some alternative options to get Jupyter working again.

端子输出:

ValueError: signal only works in main thread
ERROR:tornado.application:Exception in callback <functools.partial object at 0x111e2b208>
Traceback (most recent call last):
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 759, in _run_callback
    ret = callback()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 276, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 536, in <lambda>
    self.io_loop.add_callback(lambda : self._handle_events(self.socket, 0))
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events
    self._handle_recv()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv
    self._run_callback(callback, msg)
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 276, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    self.pre_handler_hook()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
ValueError: signal only works in main thread
[I 19:03:26.685 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
    ioloop.IOLoop.instance().start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
    raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[I 19:03:29.696 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Traceback (most recent call last):
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
    ioloop.IOLoop.instance().start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
    raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[I 19:03:32.712 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Traceback (most recent call last):
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
    ioloop.IOLoop.instance().start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
    raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[W 19:03:33.717 NotebookApp] Timeout waiting for kernel_info reply from 2cf24420-719b-4666-ad9f-fcdf8db505f3
[E 19:03:33.721 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
    Traceback (most recent call last):
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
        result = callback(*args, **kwargs)
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
        super(ZMQChannelsHandler, self).open()
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
        self.send_ping, self.ping_interval, io_loop=loop,
    TypeError: __init__() got an unexpected keyword argument 'io_loop'
[E 19:03:34.749 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
    Traceback (most recent call last):
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
        result = callback(*args, **kwargs)
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
        super(ZMQChannelsHandler, self).open()
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
        self.send_ping, self.ping_interval, io_loop=loop,
    TypeError: __init__() got an unexpected keyword argument 'io_loop'
[I 19:03:35.724 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
[E 19:03:35.771 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
    Traceback (most recent call last):
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
        result = callback(*args, **kwargs)
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
        super(ZMQChannelsHandler, self).open()
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
        self.send_ping, self.ping_interval, io_loop=loop,
    TypeError: __init__() got an unexpected keyword argument 'io_loop'
Traceback (most recent call last):
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
    ioloop.IOLoop.instance().start()
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
    raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[E 19:03:36.791 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
    Traceback (most recent call last):
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
        result = callback(*args, **kwargs)
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
        super(ZMQChannelsHandler, self).open()
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
        self.send_ping, self.ping_interval, io_loop=loop,
    TypeError: __init__() got an unexpected keyword argument 'io_loop'
[E 19:03:37.810 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
    Traceback (most recent call last):
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
        result = callback(*args, **kwargs)
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
        super(ZMQChannelsHandler, self).open()
      File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
        self.send_ping, self.ping_interval, io_loop=loop,
    TypeError: __init__() got an unexpected keyword argument 'io_loop'
[W 19:03:38.733 NotebookApp] KernelRestarter: restart failed
[W 19:03:38.733 NotebookApp] Kernel 2cf24420-719b-4666-ad9f-fcdf8db505f3 died, removing from map.
[W 19:03:38.830 NotebookApp] 404 GET /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels?session_id=3F75F379F865488D8379D3BB7FC0BF0F (::1): Kernel does not exist: 2cf24420-719b-4666-ad9f-fcdf8db505f3
[W 19:03:38.838 NotebookApp] 404 GET /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels?session_id=3F75F379F865488D8379D3BB7FC0BF0F (::1) 12.00ms referer=None
[W 19:03:40.859 NotebookApp] Replacing stale connection: 2cf24420-719b-4666-ad9f-fcdf8db505f3:3F75F379F865488D8379D3BB7FC0BF0F

推荐答案

运行以下版本的jupyter和Tornado似乎可以解决此问题:

Running the following version of jupyter and tornado seemed to solve the issue:

Jupyter:4.4.0

Jupyter: 4.4.0

龙卷风:4.5.3

我需要降级龙卷风的版本(5.0.2)

I needed to downgrade my version of tornado (which was 5.0.2)

这篇关于Jupyter笔记本内核未连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆