Skip to content

Breakpoints don't work in notebooks #844

@rchiodo

Description

@rchiodo

Environment data

  • debugpy version: 1.5.1
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.10.1
  • Using VS Code or Visual Studio: VS Code

Actual behavior

See this issue: microsoft/vscode-jupyter#8803 (and this issue: ipython/ipykernel#841)

Debugging a cell in a notebook requires you set a breakpoint on the first line. But only with Python 3.10. With Python 3.9 it doesn't require a breakpoint on the first line.

Steps to reproduce:

  1. Create a python 3.10 environment
  2. Open the attached notebook in VS code
  3. Stick a breakpoint like so:

image

  1. Click on the 'Debug Cell' in the execute button:

image

The breakpoint should hit.

Looking at the logs, it looks like the breakpoints are sent and verified:


D+00000.672: Client[1] --> {
                 "seq": 5,
                 "type": "request",
                 "command": "setBreakpoints",
                 "arguments": {
                     "source": {
                         "name": "debug_failure.ipynb",
                         "path": "C:\\Users\\aku91\\AppData\\Local\\Temp\\ipykernel_19124\\1275961667.py"
                     },
                     "lines": [
                         4
                     ],
                     "breakpoints": [
                         {
                             "line": 4
                         }
                     ],
                     "sourceModified": false
                 }
             }

D+00000.672: /handling #5 request "setBreakpoints" from Client[1]/
             Server[1] <-- {
                 "seq": 13,
                 "type": "request",
                 "command": "setBreakpoints",
                 "arguments": {
                     "source": {
                         "name": "debug_failure.ipynb",
                         "path": "C:\\Users\\aku91\\AppData\\Local\\Temp\\ipykernel_19124\\1275961667.py"
                     },
                     "lines": [
                         4
                     ],
                     "breakpoints": [
                         {
                             "line": 4
                         }
                     ],
                     "sourceModified": false
                 }
             }

But for some reason the stop event never occurs.

Notebook to repro:
debug_failure.zip

Logs of failure:
failurelogs.zip

Logs of success if I stick a breakpoint on the first line of the cell:

successlogs.zip

Metadata

Metadata

Assignees

Labels

externalThe issue is caused by external component interacting with debugpy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions