VSCode远程连接下Jupyter内核无法启动问题求助
VSCode远程连接下Jupyter内核无法启动问题求助
各位好,我最近碰到一个特别棘手的问题:在通过远程SSH连接的VSCode里,不管是运行Jupyter笔记本还是Python交互式脚本,每次都会弹出「Failed to start the Kernel. The kernel died.」的错误,折腾了好几天都没解决,想请大家帮忙分析下原因。
我的环境信息
- VSCode版本:1.101.2(远程SSH连接,桌面端)
- Jupyter扩展版本:2025.6.0
- Python扩展版本:2025.8.1
- Python Environment扩展未安装
- Pylance扩展版本:2025.6.2
- 操作系统:Linux x64
- 目标Python环境:Conda虚拟环境
lico_beorn2(Python 3.13.5),路径~/.conda/envs/lico_beorn2/bin/python
完整Jupyter日志输出
Home = /obs/username Temp Storage folder ~/.vscode-server/data/User/globalStorage/ms-toolsai.jupyter/version-2025.6.0 Workspace folder /johannes/orage/username 12:33:07.422 [info] Starting Kernel (Python Path: ~/.conda/envs/lico_beorn2/bin/python, Conda, 3.13.5) for '/johannes/orage/<username>/these/licorice/lico_beorn/simu16000.ipynb' (disableUI=true) 12:33:13.227 [info] Process Execution: ~/.conda/envs/lico_beorn2/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)" 12:33:13.243 [info] Process Execution: ~/.conda/envs/lico_beorn2/bin/python -m ipykernel_launcher --f=/run/user/1772/jupyter/runtime/kernel-v387e4965414a0d37bbb577e6d7fe314354f4ec60a.json > cwd: /johannes/orage/<username>/these/licorice/lico_beorn 12:33:13.262 [info] Process Execution: ~/.conda/envs/lico_beorn2/bin/python -m pip list 12:33:38.105 [warn] Disposing old controller startUsingPythonInterpreter:'.jvsc74a57bd098e624189647e64da77283c5cf979bca5c39a2f5dedfdb150d6c15ee8d5758f7./johannes2/orage/<username>/.venv/python./johannes2/orage/<username>/.venv/python.-m#ipykernel_launcher' for view = 'jupyter-notebook' 12:33:38.106 [warn] Disposing old controller startUsingPythonInterpreter:'.jvsc74a57bd098e624189647e64da77283c5cf979bca5c39a2f5dedfdb150d6c15ee8d5758f7./johannes2/orage/<username>/.venv/python./johannes2/orage/<username>/.venv/python.-m#ipykernel_launcher (Interactive)' for view = 'interactive' 12:33:38.108 [warn] The following kernels use interpreters that are no longer valid or not recognized by Python extension, Kernels startUsingPythonInterpreter:'id=.jvsc74a57bd098e624189647e64da77283c5cf979bca5c39a2f5dedfdb150d6c15ee8d5758f7./johannes2/orage/<username>/.venv/python./johannes2/orage/<username>/.venv/python.-m#ipykernel_launcher'(interpreterId='/johannes2/orage/<username>/.venv/bin/python') and valid interpreter ids include /johannes/orage/<username>/.venv/bin/python, /shared/apps/anaconda/3.9/bin/python, ~/.conda/envs/lico_beorn2/bin/python, ~/.conda/envs/conda-21cm-env2/bin/python, ~/.conda/envs/lico_beorn/bin/python, ~/.conda/envs/conda-21cm-env/bin/python, /usr/bin/python2.7, /usr/bin/python3 12:34:14.140 [error] Failed to request kernel info Canceled: Canceled at ud.value (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/extension.node.js:181:28934) at D.B (file://~/.vscode-server/bin/2901c5ac6db8a986a5666c3af51ff804d05af0d4/out/vs/workbench/api/node/extensionHostProcess.js:27:2373) at D.fire (file://~/.vscode-server/bin/2901c5ac6db8a986a5666c3af51ff804d05af0d4/out/vs/workbench/api/node/extensionHostProcess.js:27:2591) at hd.cancel (file://~/.vscode-server/bin/2901c5ac6db8a986a5666c3af51ff804d05af0d4/out/vs/workbench/api/node/extensionHostProcess.js:27:5107) at Ke.cancel (file://~/.vscode-server/bin/2901c5ac6db8a986a5666c3af51ff804d05af0d4/out/vs/workbench/api/node/extensionHostProcess.js:27:5518) at Timeout._onTimeout (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/extension.node.js:309:11834) at listOnTimeout (node:internal/timers:588:17) at processTimers (node:internal/timers:523:7) 12:34:14.155 [warn] Failed to shutdown kernel, .jvsc74a57bd0e4f142c8266e28d595c83f711b684bd0263c61a70288d740f270c0fd91de6e79.~/.conda/envs/lico_beorn2/python.~/.conda/envs/lico_beorn2/python.-m#ipykernel_launcher TypeError: Failed to parse URL from /api/kernels/0edea15c-a2fd-4837-b849-c2f209ef732e?1752143654154 at new Request (node:internal/deps/undici/undici:9588:19) at Object.t [as handleRequest] (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/node_modules/@jupyterlab/services/lib/kernel/default/index.js:11:2049) ... 9 lines matching cause stack trace ... at Function.wrapKernelMethodImpl (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/extension.node.js:309:84404) { [cause]: TypeError: Invalid URL at new URL (node:internal/url:818:25) at new Request (node:internal/deps/undici/undici:9586:25) at Object.t [as handleRequest] (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/node_modules/@jupyterlab/services/lib/kernel/default/index.js:11:2049) at Object.t [as makeRequest] (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/node_modules/@jupyterlab/services/lib/kernel/default/index.js:11:490) at Object.kf [as shutdownKernel] (~/.vscode-server/extensions/ms-toolsai.jupyter-2025.6.0/dist/node_modules/@jupyterlab/services/lib/kernel/default/index.js:11:44304) at n.shutdown (~/.vsc
从日志里我揪出几个可疑的点:比如有个旧虚拟环境的解释器被标记为无效,还有内核关闭时出现了URL解析错误。但我拿不准这些是不是导致内核启动失败的根本原因,也完全不知道该从哪入手排查。有没有朋友遇到过类似的情况,或者能帮我解读下日志里的关键信息?
内容来源于stack exchange




