【发布时间】:2021-09-21 16:56:50
【问题描述】:
我正在尝试使用 miniconda 运行 jupyter lab,但 Jupyter 无法与内核连接。以下是一些背景信息、我已完成的步骤以及产生的代码。
背景资料
- 我已经成功使用 jupyter lab 几个月了。
- 直到今天才开始出现此问题。
- 我怀疑这与我今天早上安装了XCode Command Line Tools 13有关,该工具昨天才发布,但是降级到12.5.1后出现了同样的问题。
- 我正在使用 miniconda。
步骤
- 创建一个全新的 conda 环境
- 用
conda activate test激活它 - 然后我运行
conda install jupyterlab - 安装后,我运行
jupyter lab打开浏览器并导航到我的.ipynb
现在,浏览器的左下角写着“Python 3 (ipykernel) | Connecting”,并没有多说。以下是日志摘要:
常规日志输出
这是最初的信息(我不认为它包含任何新奇的东西,但可能有助于回答您可能有的一些我没有想到的问题):
[I 2021-09-21 09:36:33.353 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-09-21 09:36:34.278 ServerApp] nbclassic | extension was successfully linked.
[I 2021-09-21 09:36:34.509 LabApp] JupyterLab extension loaded from /opt/miniconda3/envs/test/lib/python3.9/site-packages/jupyterlab
[I 2021-09-21 09:36:34.509 LabApp] JupyterLab application directory is /opt/miniconda3/envs/test/share/jupyter/lab
[I 2021-09-21 09:36:34.515 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-09-21 09:36:34.526 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-09-21 09:36:34.527 ServerApp] Serving notebooks from local directory: /Users/connorpancoast/Code/grassmaNN
[I 2021-09-21 09:36:34.527 ServerApp] Jupyter Server 1.4.1 is running at:
[I 2021-09-21 09:36:34.527 ServerApp] http://localhost:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
[I 2021-09-21 09:36:34.527 ServerApp] or http://127.0.0.1:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
[I 2021-09-21 09:36:34.527 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-09-21 09:36:34.535 ServerApp]
To access the server, open this file in a browser:
file:///Users/connorpancoast/Library/Jupyter/runtime/jpserver-24903-open.html
Or copy and paste one of these URLs:
http://localhost:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
or http://127.0.0.1:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
之后事情就变得奇怪了。
奇怪的日志输出
首先是关于nodejs 的警告,它可能重要也可能不重要。
[W 2021-09-21 09:36:39.621 LabApp] Could not determine jupyterlab build status without nodejs
/opt/miniconda3/envs/test/lib/python3.9/json/encoder.py:257: UserWarning: date_default is deprecated since jupyter_client 7.0.0. Use jupyter_client.jsonutil.json_default.
return _iterencode(o, 0)
接下来,内核启动,但连接超时。
[I 2021-09-21 09:36:51.114 ServerApp] Kernel started: b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:51.549 ServerApp] Timeout waiting for kernel_info reply from b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:56.092 ServerApp] Nudge: attempt 10 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:56.093 ServerApp] Nudge: attempt 10 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:56.109 ServerApp] Nudge: attempt 10 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
我不确定为什么会发生三个单独的“轻推过程”,但在 120 次轻推尝试(如图所示)之后,此错误消息也出现了 3 次,未显示空格:
[W 2021-09-21 09:38:51.474 ServerApp] Nudge: attempt 120 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:38:51.475 ServerApp] Nudge: attempt 120 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:38:51.476 ServerApp] Nudge: attempt 120 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[E 2021-09-21 09:38:51.558 ServerApp] Uncaught exception GET /api/kernels/b38270f5-9a72-42cf-86e5-0e8e4b3b9514/channels?session_id=f834b0b3-b8ed-4b2d-bfc9-7a535593a24f (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/b38270f5-9a72-42cf-86e5-0e8e4b3b9514/channels?session_id=f834b0b3-b8ed-4b2d-bfc9-7a535593a24f', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/opt/miniconda3/envs/test/lib/python3.9/site-packages/tornado/websocket.py", line 956, in _accept_connection
await open_result
tornado.util.TimeoutError: Timeout
在这些之后,出现:
[W 2021-09-21 09:39:21.571 ServerApp] WebSocket ping timeout after 90003 ms.
[W 2021-09-21 09:39:21.585 ServerApp] WebSocket ping timeout after 90003 ms.
[W 2021-09-21 09:42:51.594 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:ee46fa70-0af0-489d-8993-acf4f55bf3aa
[W 2021-09-21 09:42:52.123 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:ee46fa70-0af0-489d-8993-acf4f55bf3aa
/opt/miniconda3/envs/test/lib/python3.9/json/encoder.py:257: UserWarning: date_default is deprecated since jupyter_client 7.0.0. Use jupyter_client.jsonutil.json_default.
return _iterencode(o, 0)
[I 2021-09-21 09:46:52.126 ServerApp] Starting buffering for b38270f5-9a72-42cf-86e5-0e8e4b3b9514:ee46fa70-0af0-489d-8993-acf4f55bf3aa
[W 2021-09-21 09:46:52.146 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:f834b0b3-b8ed-4b2d-bfc9-7a535593a24f
[W 2021-09-21 09:46:55.306 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:1db7c82b-2627-4c43-b9d3-da7bef15ca32
【问题讨论】:
标签: python jupyter-notebook anaconda conda jupyter-lab