Skip to content

[Jupyter Integration w/ Docker] Debugger breaks at the wrong place #664

@DonJayamanne

Description

@DonJayamanne

Environment data

  • debugpy version: 1.3.0 (run import debugpy; print(debugpy.__version__) if uncertain)
  • OS and version: Linux 5.4.0
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9
  • Using VS Code or Visual Studio: VS Code Code Spaces

Actual behavior

Debugger stops at interactiveShell.py file at the lie sys.execthook = old_excepthook
This seems to be reproducible only in containers or codespaces.

Expected behavior

Debugger should stop in the code that the user same. In my example i ran sample.py. Hence it should break either in sample.py or a temporary file with the same code.

Please note: In desktop, the issue with source mappings will be resolved in the latest Jupyter extension, see here microsoft/vscode-jupyter#6534

Steps to reproduce:

  1. Ensure you have docker up n running
  2. Clone the repo https://github.com/DonJayamanne/testDebugPyInContainer
  3. Open in VS Code Containers
    3. Open folder in VS Code
    4. When prompted to open in Container click yes
  4. Install the Python & Jupyter Extension from marketplace
  5. Ensure you select Python 3.9 as your workspace interpreter in python (bottom left statusbar)
  6. Pip install ipykernel into the Python 3.9 environment
    8 . Create a file named sample.py and the the following code
# %% 
print('Hello World')
  1. Code lenses will appear Run Cell | Run Below | Debug Cell
  2. Click Run cell and confirm it gets executed
  3. Close the interactive window that opened on the right side (ensure you have just the Python file opened)
  4. Now click Debug Cell
  5. Notice how the debugger starts and stops at interactiveShell.py file at the lie sys.execthook = old_excepthook

Note:

  • Latest ipykernel 6.0 ships with debugpy. You can optionally chose to downgrade to the older version.
  • pip uninstall ipykernel debugpy ipython
  • python -m pip install ipython==7.15.0 ipykernel==5.5.5

However even with this (old version), the issue repros.

Screen Shot 2021-07-16 at 14 29 13

debug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions