调试Jupyter单元格报错:Pip module Unable to parse debugpy output
调试Jupyter单元格失败问题排查
问题现象
- 调试Jupyter笔记本或带有
#%%标记的.py文件单元格时失败,IDE弹出提示:Pip module Unable to parse debugpy output,.. - 调试无Jupyter单元格的常规Python文件可正常运行
错误日志
warn 09:42:53.944: StdErr from Kernel Process warn 09:42:53.945: StdErr from Kernel Process self._abc_registry = extra._abc_registry ^^^^^^^^^^^^^^^^^^^ AttributeError: type object 'Callable' has no attribute '_abc_registry' error 09:43:04.220: Execute_request failure enabling debugging for IW import debugpy;debugpy.listen(('localhost', 0)) RuntimeError: timed out waiting for adapter to connect [...] error 09:43:04.221: Error in execution (get message for cell) o [Error]: Pip module Unable to parse debugpy output, please log an issue with https://github.com/microsoft/vscode-jupyter is required for debugging cells. You will need to install it to debug cells. at b.connectToLocal (/home/▊▊/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/extension.node.js:2:1670191) at b.connect (/home/▊▊/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/extension.node.js:2:1668450) at b.startDebugSession (/home/▊▊/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/extension.node.js:2:1667593) at W.createExecutionPromise (/home/▊▊/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/extension.node.js:2:1758452) { category: 'notinstalled', kernelConnectionMetadata: { kind: 'startUsingPythonInterpreter', kernelSpec: { specFile: '/home/▊▊/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/temp/jupyter/kernels/python3110jvsc74a57bd09fb97b32d59ec2ca028f3a87eaecd7fdd4e02bf50258ec96057fa127230d231f/kernel.json', interpreterPath: '/home/▊▊/▊▊/venv/bin/python', isRegisteredByVSC: 'registeredByNewVersionOfExt', name: 'python3110jvsc74a57bd09fb97b32d59ec2ca028f3a87eaecd7fdd4e02bf50258ec96057fa127230d231f', argv: [Array], language: 'python', executable: 'python', display_name: "Python 3.11.0 ('venv': venv)", metadata: [Object], env: {} }, interpreter: { id: '/home/▊▊/▊▊/venv/bin/python', sysPrefix: '/home/▊▊/▊▊/venv', envType: 'Venv', envName: 'venv', envPath: [h], architecture: 3, sysVersion: '3.11.0 (main, Oct 24 2022, 19:56:13) [GCC 11.2.0]', version: [Object], displayName: "Python 3.11.0 ('venv': venv)", detailedDisplayName: "Python 3.11.0 ('venv': venv)", uri: [h] }, id: '.jvsc74a57bd09fb97b32d59ec2ca028f3a87eaecd7fdd4e02bf50258ec96057fa127230d231f./home/▊▊/▊▊/venv/python./home/▊▊/▊▊/venv/python.-m#ipykernel_launcher' } }
环境信息
- 系统:Ubuntu 22.04
- IDE:VSCode
- Python版本:3.11(更换3.7、3.10版本后问题仍存在)
- 虚拟环境:venv
解决方案
- 升级debugpy:激活虚拟环境后执行
pip install --upgrade debugpy - 更新Jupyter依赖:执行
pip install --upgrade ipykernel jupyter - 重置VSCode Jupyter扩展:打开VSCode扩展面板,找到Jupyter扩展,点击齿轮图标选择「重置扩展设置」,重启IDE
- 重建虚拟环境:删除现有虚拟环境,重新创建并安装所有依赖,避免环境损坏引发的兼容性问题
- 排查扩展冲突:暂时禁用其他Python相关扩展,测试是否能正常调试
内容的提问来源于stack exchange,提问作者evod
相关产品推荐
相关产品推荐

