Search code examples
visual-studio-codebreakpointsvscode-debugger

VS Code cannot breakpoint or step through 3rd party Python code from Jupyter Notebook


One of my main uses for a debugger is to step through parts of new libraries to better understand how they work and how to use them. But, my current install of VS Code refuses to let me set breakpoints or step through 3rd party libraries when I start debugging in Jupyter Notebook. I get a 'Breakpoint in file excluded by filters' error.

I've looked through everything I could find online about this problem, and nothing I've tried has worked. I have:

  • In File > Preferences > Settings > Debug turned on 'Allow breakpoints everywhere' for both User and Workspace
  • In ... Settings > Extensions > Jupyter turned off 'Debug Just My Code' for both
  • In launch.json changed ' "justMyCode": true ' to ' "justMyCode": false '
  • After suggestions in How to disable "just my code" setting in VSCode debugger?, I tried to add a separate debug configuration to launch.json. This used to do the trick, but ' "request": "test" ' can no longer be used. Various alternatives I've tried here also do not work (e.g. "request": "attach" or "purpose": "debug-test").

The problem does not exist when I use a python file with the same code. So whatever is applying filters is only doing so when I seek to debug a cell in Jupyter Notebook.


Solution

  • For others, the issue has been resolved, see release notes: "Just My Code" for notebook cell debugging.

    "Just My Code" for notebook cell debugging

    The "Just My Code" debug feature allows the user to determine whether the debugger will step through code from Python libraries, or will only step through user code. This has been enabled by default when debugging a notebook cell, and you can now set "jupyter.debugJustMyCode": false to disable it and allow stepping through library code. For the best experience, upgrade debugpy in your environment to >=1.6.3. Previously, this setting was only respected for debugging using the Interactive Window. Now it is respected in notebook editors as well.