从终端启动 jupyter lab 时启动内核无法获取错误

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

我觉得这可能是一个非常简单的修复,因为这是一个常见的问题,但出于某种原因,我在 stackoverflow 上找到的所有解决方案都不适合我(尽管我可能只是误解了应用程序)。我使用Windows10,我总是从Powershell终端启动jupyter lab作为

$ jupyter lab
,我最近更新了Python 3.10。到 3.12.2,我还使用
$ pip install --upgrade IPython ipykernel ipywidgets jupyter_client jupyter_core jupyter_server jupyterlab nbclient nbconvert nbformat notebook qtconsole traitlets
更新了 jupyter,因为我在 stackoverflow 上看到一篇文章建议手动将每个核心包名称输入到更新命令中。

无论我做什么,当我打开 jupyter lab 时,它都会循环出现 2 个警告:

  • “启动内核时出错,无法获取”

  • “服务器连接错误无法建立与 Jupyter 服务器的连接。JupyterLab 将继续尝试重新连接。请检查您的网络连接或 Jupyter 服务器配置。”

但是,如果我没记错的话,jupyter 实验室在任何更新之前都会这样做。唯一可用的内核被列为“Python 3 (ipykernel)”。 Jupyter 笔记本也遇到同样的警告弹出窗口。

我尝试了

$ jupyter kernelspec list
,打开kernel.json文件,然后输入我想要它采用的路径;它存储在
python3    C:\Users\M S\AppData\Local\Programs\Python\Python310\share\jupyter\kernels\python3
中,我为
argv
输入的路径是
"C:\\Users\\M S\\AppData\\Local\\Programs\\Python\\Python312\\python.exe"
。当这没有改变任何东西时,我将
argv
恢复到原来的样子——只是
"python"

我在终端中尝试了以下行序列:

  • python -m venv \AppData\Local\Programs\Python\Python312
  • python -m pip install ipykernel
  • python -m ipykernel install --name python3.12.2kernel --display-name "Python 3.12.2 (ipykernel)" --user
    然后尝试从该内核开始。

我尝试进入 .jupyter\lab\workspaces 并删除最新的默认工作区。

我尝试卸载旧的 Python 版本,卸载 jupyter,然后仅重新安装 jupyterlab。

我已尝试删除浏览器缓存。

我已经一年多没有重新访问 Python 或 jupyter 了,也从未非常深入地了解过这门语言。我是个菜鸟,所以请告诉我是否需要任何其他信息来解决此问题,如果答案存在于其他地方,我将删除该帖子。感谢您的阅读

python python-3.x jupyter-notebook jupyter jupyter-lab
1个回答
0
投票

在仔细查看了当我尝试运行 jupyter lab 时 Powershell 吐出的内容后,我找到了问题的答案 here:在启动 jupyter lab 之前,它最后吐出

Bad address (C:\projects\libzmq\src\epoll.cpp:100)
,显然与我安装的一个VPN软件修改了我的默认winsock设置。

我以管理员身份运行

netsh winsock reset
,重新启动计算机,jupyter lab 已启动并运行。

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