VSCode中Jupyter Notebook启动Kernel报错的解决方法咨询
VSCode启动Jupyter Kernel失败的解决方法
问题详情
启动VSCode中的Jupyter Notebook Kernel时失败,报错信息如下:
Failed to start the Kernel. c:\ProgramData\Anaconda3\lib\site-packages\traitlets\traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5. warn( c:\ProgramData\Anaconda3\lib\site-packages\traitlets\traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '650acb8e-de88-49d4-83a0-12cbf7a674c3' instead of 'b"650acb8e-de88-49d4-83a0-12cbf7a674c3"'. warn( Bad file descriptor (bundled\zeromq\src\epoll.cpp:100).
(报错截图:
)
修复步骤
1. 升级traitlets包
报错明确提示traitlets 5.0已弃用字符串额外引号的写法,直接升级到最新兼容版本:
- 使用conda:
conda update traitlets -y - 使用pip:
pip install --upgrade traitlets
2. 更新ZeroMQ相关依赖
Bad file descriptor错误与ZeroMQ组件有关,升级对应依赖包:
- 使用conda:
conda update pyzmq -y - 使用pip:
pip install --upgrade pyzmq
3. 重置Jupyter配置
若配置文件存在格式异常,可重置配置:
- 执行命令定位Jupyter配置目录:
jupyter --config-dir - 删除该目录下的
jupyter_notebook_config.py等配置文件 - 重启VSCode后重新启动Kernel
4. 更换Python环境测试
如果当前环境存在依赖冲突,新建干净环境测试:
conda create -n jupyter_fix python=3.10 -y conda activate jupyter_fix pip install jupyter
在VSCode中切换到这个新环境的Kernel,尝试启动。
内容的提问来源于stack exchange,提问作者Charlie Kou
相关产品推荐
相关产品推荐

