Search code examples
pythonjupytertypingdebugpy

Debugging Jupyter cells fails with "Pip module Unable to parse debugpy output"


I am trying to debug Jupyter notebooks (and also cells in .py files demarked with #%%) but it does not work. After a while the IDE pop up a note Pip module Unable to parse debugpy output,..

Debugging "regular" python files, i.e. no jupyter cells, works fine.

The jupyter log shows:

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'
  }
}

My environment: Ubuntu 22.04, VSCode, Python 3.11.

I tried different python versions (3.7, 3.10) but the problem persists.


Solution

  • I could solve this issue by making sure that typing is not installed (typing 3.7.4 was added by a 3rd party library)

    pip uninstall typing

    This post pointed me in the right direction: AttributeError: type object 'Callable' has no attribute '_abc_registry'