多次尝试后无法让 Jupyter Notebook 运行

问题描述 投票:0回答:1

自上周以来经过多次尝试,我一直无法运行 Jupyter 笔记本或实验室。我曾经从 Windows 11 的 VS Code 运行,并且有许多 .ipynb 文件,如果我不做任何我所知道的非典型操作,我现在无法连接到内核来运行 Jupyter 笔记本的一个单元。不幸的是,我不擅长计算,无法解决问题。内核在超时之前等待很长时间才能连接。经过多次搜索,我尝试了其他帖子中的一些修复,但没有成功。

  1. 我重新启动了 VS Code 和我的计算机,但没有成功。我还尝试在 Jupyter Lab (

    jupyter lab
    ) 和 Jupyter Notebook (
    jupyter
    ) 上打开一个新的笔记本会话并运行一个简单的
    print('hello world')
    单元,但每次尝试仍然挂起至少 10 分钟并且无法连接到内核。

  2. 按照SO和其他地方的建议,我尝试使用以下命令卸载并重新安装Jupyter:

    python -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat jupyterlab-widgets nbclient
    并使用以下命令重新安装:
    pip install jupyterlab
    。 这没有帮助。

  3. 按照另一个建议,我创建了一个虚拟环境,重新安装了jupyter,并尝试启动一个笔记本实例,但仍然遇到同样的问题。

  4. 我尝试按照this SO post升级jupyter。

  5. SO 和许多其他解决方案似乎与将其中一个软件包更新到新版本有关。我尝试过其中一些,但没有成功;不幸的是我没有跟踪所有这些。

  6. 我遵循了问题 9014 中的指南,但它似乎并不适用,因为我不知道在完成所有故障排除后如何仍然可以打开活动会话。

如果有人可以提供帮助,我将非常感激。我花了几个小时,并且已经开始将我的所有笔记本文件转换为 .py 脚本,因为我担心我无法解决这个问题。

我正在跑步:

  • Python 3.9.1 64 位

此时,我根本无法从 VS 代码或命令行运行 Jupyter,因为它在几乎无限的时间内无法连接。我采取的 6 个故障排除步骤包含在“问题详细信息”部分中。

在Jupyter笔记本中,它卡在:

'内核正在启动,请稍候...”。

在 VS Code 中,卡在:

连接到内核:Python 3.9.1 64位:激活Python环境“Python 3.9.1 64位”

从我上次尝试复制的命令行输出如下:

PS C:\Users\wbpla\OneDrive\python_work\cbb> jupyter lab
c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\jupyter_server\transutils.py:13: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  warnings.warn(warn_msg, FutureWarning)
[I 2022-11-06 08:57:57.182 ServerApp] jupyterlab | extension was successfully linked.
[W 2022-11-06 08:57:57.198 ServerApp] The 'min_open_files_limit' trait of a ServerApp instance expected an int, not the NoneType None.
[W 2022-11-06 08:57:57.214 ServerApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 2022-11-06 08:57:57.214 LabApp] JupyterLab extension loaded from c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\jupyterlab
[I 2022-11-06 08:57:57.214 LabApp] JupyterLab application directory is C:\Users\wbpla\AppData\Local\Programs\Python\Python39\share\jupyter\lab
[I 2022-11-06 08:57:57.214 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-11-06 08:57:57.417 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-11-06 08:57:57.417 ServerApp] Serving notebooks from local directory: C:\Users\wbpla\OneDrive\python_work\cbb
[I 2022-11-06 08:57:57.417 ServerApp] Jupyter Server 1.6.4 is running at:
[I 2022-11-06 08:57:57.417 ServerApp] http://localhost:8888/lab?token=7ba9196b42de16070141cce6550ff5b7f27917e959997a71
[I 2022-11-06 08:57:57.417 ServerApp]     http://127.0.0.1:8888/lab?token=7ba9196b42de16070141cce6550ff5b7f27917e959997a71
[I 2022-11-06 08:57:57.417 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-11-06 08:57:57.464 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/wbpla/AppData/Roaming/jupyter/runtime/jpserver-12584-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=7ba9196b42de16070141cce6550ff5b7f27917e959997a71
        http://127.0.0.1:8888/lab?token=7ba9196b42de16070141cce6550ff5b7f27917e959997a71
c:\users\wbpla\appdata\local\programs\python\python39\lib\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)
[W 2022-11-06 08:58:01.206 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.214 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.275 ServerApp] Config option `template_path` not recognized by `TocExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.281 ServerApp] Config option `template_path` not recognized by `TocExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.317 ServerApp] Config option `template_path` not recognized by `LenvsHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.335 ServerApp] Config option `template_path` not recognized by `LenvsHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.370 ServerApp] Config option `template_path` not recognized by `LenvsTocHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.370 ServerApp] Config option `template_path` not recognized by `LenvsTocHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.436 ServerApp] Config option `template_path` not recognized by `LenvsLatexExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.452 ServerApp] Config option `template_path` not recognized by `LenvsLatexExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.858 ServerApp] Config option `template_path` not recognized by `LenvsSlidesExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:01.870 ServerApp] Config option `template_path` not recognized by `LenvsSlidesExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.071 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.131 ServerApp] Config option `template_path` not recognized by `TocExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.160 ServerApp] Config option `template_path` not recognized by `LenvsHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.190 ServerApp] Config option `template_path` not recognized by `LenvsTocHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.240 ServerApp] Config option `template_path` not recognized by `LenvsLatexExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.513 ServerApp] Config option `template_path` not recognized by `LenvsSlidesExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[I 2022-11-06 08:58:02.675 LabApp] Build is up to date
[W 2022-11-06 08:58:02.852 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.862 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.917 ServerApp] Config option `template_path` not recognized by `TocExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.932 ServerApp] Config option `template_path` not recognized by `TocExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.948 ServerApp] Config option `template_path` not recognized by `LenvsHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.963 ServerApp] Config option `template_path` not recognized by `LenvsHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:02.995 ServerApp] Config option `template_path` not recognized by `LenvsTocHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.010 ServerApp] Config option `template_path` not recognized by `LenvsTocHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.073 ServerApp] Config option `template_path` not recognized by `LenvsLatexExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.073 ServerApp] Config option `template_path` not recognized by `LenvsLatexExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.385 ServerApp] Config option `template_path` not recognized by `LenvsSlidesExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.401 ServerApp] Config option `template_path` not recognized by `LenvsSlidesExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.557 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.604 ServerApp] Config option `template_path` not recognized by `TocExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.635 ServerApp] Config option `template_path` not recognized by `LenvsHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.666 ServerApp] Config option `template_path` not recognized by `LenvsTocHTMLExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:03.713 ServerApp] Config option `template_path` not recognized by `LenvsLatexExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:04.010 ServerApp] Config option `template_path` not recognized by `LenvsSlidesExporter`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?
[W 2022-11-06 08:58:04.058 ServerApp] 404 GET /api/contents/cfb/CFB_Daily_Run.ipynb?content=0&1667746682691 (::1): No such file or directory: cfb/CFB_Daily_Run.ipynb
[W 2022-11-06 08:58:04.058 ServerApp] No such file or directory: cfb/CFB_Daily_Run.ipynb
[W 2022-11-06 08:58:04.060 ServerApp] 404 GET /api/contents/cfb/CFB_Daily_Run.ipynb?content=0&1667746682691 (::1) 3.99ms referer=http://localhost:8888/lab
[W 2022-11-06 08:58:04.060 ServerApp] 404 GET /api/contents/cbb/Untitled.ipynb?content=0&1667746682690 (::1): No such file or directory: cbb/Untitled.ipynb
[W 2022-11-06 08:58:04.060 ServerApp] No such file or directory: cbb/Untitled.ipynb
[W 2022-11-06 08:58:04.061 ServerApp] 404 GET /api/contents/cbb/Untitled.ipynb?content=0&1667746682690 (::1) 3.99ms referer=http://localhost:8888/lab
[W 2022-11-06 08:58:04.156 ServerApp] 404 GET /api/contents/cfb?1667746684153 (::1): No such file or directory: cfb
[W 2022-11-06 08:58:04.157 ServerApp] No such file or directory: cfb
[W 2022-11-06 08:58:04.158 ServerApp] 404 GET /api/contents/cfb?1667746684153 (::1) 1.99ms referer=http://localhost:8888/lab
c:\users\wbpla\appdata\local\programs\python\python39\lib\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 2022-11-06 08:58:07.156 ServerApp] Creating new notebook in
[I 2022-11-06 08:58:07.473 ServerApp] Kernel started: 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:07.529 ServerApp] Timeout waiting for kernel_info reply from 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:14.972 ServerApp] Nudge: attempt 10 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:14.972 ServerApp] Nudge: attempt 10 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:14.972 ServerApp] Nudge: attempt 10 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:20.110 ServerApp] Nudge: attempt 20 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:20.110 ServerApp] Nudge: attempt 20 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:20.110 ServerApp] Nudge: attempt 20 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:25.220 ServerApp] Nudge: attempt 30 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:27.152 ServerApp] Nudge: attempt 30 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:27.152 ServerApp] Nudge: attempt 30 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:32.215 ServerApp] Nudge: attempt 40 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:32.215 ServerApp] Nudge: attempt 40 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:32.215 ServerApp] Nudge: attempt 40 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:37.285 ServerApp] Nudge: attempt 50 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:37.285 ServerApp] Nudge: attempt 50 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:37.285 ServerApp] Nudge: attempt 50 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:42.362 ServerApp] Nudge: attempt 60 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:42.363 ServerApp] Nudge: attempt 60 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:42.364 ServerApp] Nudge: attempt 60 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:47.466 ServerApp] Nudge: attempt 70 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:47.466 ServerApp] Nudge: attempt 70 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:47.466 ServerApp] Nudge: attempt 70 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:52.568 ServerApp] Nudge: attempt 80 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:52.568 ServerApp] Nudge: attempt 80 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:52.568 ServerApp] Nudge: attempt 80 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:57.663 ServerApp] Nudge: attempt 90 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:57.664 ServerApp] Nudge: attempt 90 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 08:59:57.664 ServerApp] Nudge: attempt 90 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 09:00:02.742 ServerApp] Nudge: attempt 100 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 09:00:02.742 ServerApp] Nudge: attempt 100 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 09:00:02.743 ServerApp] Nudge: attempt 100 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 09:00:07.798 ServerApp] Nudge: attempt 110 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 09:00:07.798 ServerApp] Nudge: attempt 110 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[W 2022-11-06 09:00:07.799 ServerApp] Nudge: attempt 110 on kernel 8c5cd803-d514-424c-9345-dc9cc6600c8a
[I 2022-11-06 09:00:08.169 ServerApp] Saving file at /Untitled.ipynb
[E 2022-11-06 09:00:10.423 ServerApp] Uncaught exception GET /api/kernels/8c5cd803-d514-424c-9345-dc9cc6600c8a/channels?session_id=c39e52f0-4e25-491c-a0ee-d9a668a8138f (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/8c5cd803-d514-424c-9345-dc9cc6600c8a/channels?session_id=c39e52f0-4e25-491c-a0ee-d9a668a8138f', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\tornado\websocket.py", line 944, in _accept_connection
        await open_result
    asyncio.exceptions.TimeoutError: Timeout
[E 2022-11-06 09:00:10.423 ServerApp] Uncaught exception GET /api/kernels/8c5cd803-d514-424c-9345-dc9cc6600c8a/channels?session_id=c240751f-ce98-4f52-959e-f9fa0ab8be43 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/8c5cd803-d514-424c-9345-dc9cc6600c8a/channels?session_id=c240751f-ce98-4f52-959e-f9fa0ab8be43', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\tornado\websocket.py", line 944, in _accept_connection
        await open_result
    asyncio.exceptions.TimeoutError: Timeout
[E 2022-11-06 09:00:10.423 ServerApp] Uncaught exception GET /api/kernels/8c5cd803-d514-424c-9345-dc9cc6600c8a/channels?session_id=c23fc1b0-d9e3-43dd-b9cc-6e4ce03fa517 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/8c5cd803-d514-424c-9345-dc9cc6600c8a/channels?session_id=c23fc1b0-d9e3-43dd-b9cc-6e4ce03fa517', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\tornado\websocket.py", line 944, in _accept_connection
        await open_result
    asyncio.exceptions.TimeoutError: Timeout
[W 2022-11-06 09:00:10.423 ServerApp] Replacing stale connection: 8c5cd803-d514-424c-9345-dc9cc6600c8a:c39e52f0-4e25-491c-a0ee-d9a668a8138f
[W 2022-11-06 09:00:10.735 ServerApp] Replacing stale connection: 8c5cd803-d514-424c-9345-dc9cc6600c8a:c240751f-ce98-4f52-959e-f9fa0ab8be43
[E 2022-11-06 09:00:40.406 ServerApp] Exception in callback <bound method WebSocketMixin.send_ping of ZMQChannelsHandler(8c5cd803-d514-424c-9345-dc9cc6600c8a)>
    Traceback (most recent call last):
      File "c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\tornado\ioloop.py", line 921, in _run
        val = self.callback()
      File "c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\jupyter_server\base\zmqhandlers.py", line 184, in send_ping
        self.ping(b'')
      File "c:\users\wbpla\appdata\local\programs\python\python39\lib\site-packages\tornado\websocket.py", line 444, in ping
        raise WebSocketClosedError()
    tornado.websocket.WebSocketClosedError
[W 2022-11-06 09:01:10.422 ServerApp] WebSocket ping timeout after 120007 ms.
jupyter-notebook jupyter ipython
1个回答
0
投票

我建议跑步

conda update conda 

之前

conda update --all

解决所有依赖冲突。该问题仅是由于 jupyter lab 的扩展冲突所致

© www.soinside.com 2019 - 2024. All rights reserved.