【问题标题】:Jupyter notebook failing to connect to kernelJupyter notebook 无法连接到内核
【发布时间】:2019-03-02 22:04:46
【问题描述】:

我正在尝试使用 Python 3 内核(检查了它在 kernelspec 列表中)。

我创建了一个笔记本,并在第一个单元格中print("test")

当我执行单元格时,什么也没有发生。我只看到In[*]。它似乎永远不会执行。

最终我得到:

Connection failed
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.

这是唯一运行的笔记本。我可以看到 Juptyer 仍在终端中运行。

我在运行最新 Chrome 的 Mac OSX 上。通过 pip3 安装 Jupyter,通过 Brew 安装 python3。

在 Chrome 控制台中,我看到的唯一错误是:

kernel.js:461 WebSocket connection to 'ws://localhost:8888/api/kernels/b9458856-e8f1-43b1-b91e-c50a9bb637bb/channels?session_id=7ded0972f5ce4517af94f45d6e0e16cf' failed: Error during WebSocket handshake: Unexpected response code: 200

我在终端看到的唯一错误是:

Warning: coroutine 'WebSocketHandler.get' was never awaited
  super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs)

其他一切看起来都很正常。

有什么想法会导致 websocket 返回 200?

更新: 笔记本服务器的版本是:5.7.4 服务器在这个版本的 Python 上运行: Python 3.7.2(默认,2019 年 2 月 12 日,08:16:38) [Clang 10.0.0 (clang-1000.11.45.5)]

【问题讨论】:

    标签: python-3.x jupyter-notebook


    【解决方案1】:

    在使用 python3 virtualenv 的 mac 上遇到同样的问题

    在你的环境或 venv 的终端中或尝试:

    sudo pip3 uninstall tornado
    sudo pip3 install tornado==5.1.1
    

    归功于: vvk2001github at:https://github.com/jupyter/notebook/issues/4399

    【讨论】:

    • 就是这样。谢谢!知道这样做的后果是什么吗?
    猜你喜欢
    • 2019-07-24
    • 1970-01-01
    • 2020-12-21
    • 1970-01-01
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多