Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't step into external code files while debugging #362

Closed
scruel opened this issue Jun 9, 2024 · 14 comments
Closed

Can't step into external code files while debugging #362

scruel opened this issue Jun 9, 2024 · 14 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@scruel
Copy link

scruel commented Jun 9, 2024

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false,
        }
    ]
}

Logs:

2024-06-10 00:57:09.404 [info] Send text to terminal: �
2024-06-10 00:57:09.605 [info] Send text to terminal:  cd /home/scruel/Code/Python/xtorch ; /usr/bin/env /home/scruel/mambaforge/envs/xtorch/bin/python /home/scruel/.vscode-server/extensions/ms-python.debugpy-2024.6.0/bundled/libs/debugpy/adapter/../../debugpy/launcher 56247 -- /home/scruel/Code/Python/xtorch/main.py
2024-06-10 00:57:09.154 [info] DAP Server launched with command: /home/scruel/mambaforge/envs/xtorch/bin/python /home/scruel/.vscode-server/extensions/ms-python.debugpy-2024.6.0/bundled/libs/debugpy/adapter

image

I can manually click to call stack to jump, and the active code line is green rather than yellow:
image

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jun 9, 2024
@Clark-G
Copy link

Clark-G commented Jun 10, 2024

I have the exactly same issue, hope to fix this quickly

@Andrej730
Copy link

Andrej730 commented Jun 10, 2024

Got the same issue lately.

Even if you manually select "from_pretrained" in a call stack and then do F10 it will jump back to .

Sometimes it's getting even more in the way when there are one more external level - you won't be able to select the layer right away, first you'll need to click "Show N more stack frames" to see "from_pretrained" entry. And on each step layers get hidden and you need to reload them again.

As a current workaround, you can open the layer you need to keep it in a separate VS Code window - so you'll have both and "from_pretrained" files on the screen, then atleast you'll be able to follow the debugger steps. But it doesn't help with variables/watch sections.

My version:

Version: 1.91.0-insider (user setup)
Commit: fec18ef7d6793521c4683e67e569579ea970cc6d
Date: 2024-06-10T05:48:36.787Z
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22635
Python Debugger: v2024.7.11591013 (pre-release)

A way to reproduce this

Disable "justmycode" in user settings:
image

import inspect
import sys
inspect.getmembers(sys) # set breakpoint here and do step in with F11

Launch debugger without launch.json:
image

@yasserben
Copy link

I am encountering the same issue as well

@avishek-mondal
Copy link

avishek-mondal commented Jun 10, 2024

Hi, I am encountering the same issue as well.

This is my minimum reproducible example:

from transformers import BertTokenizerFast, BertModel


def main():
    model_name = "google-bert/bert-base-uncased"
    tokenizer = BertTokenizerFast.from_pretrained(model_name)
    model = BertModel.from_pretrained(model_name)

    words = [
        ["word1*word2|word3"],
        ["word1*", "word2|", "word3"],
    ]

    tokenizer_out = tokenizer(
        text=words,
        is_split_into_words=True,
        return_offsets_mapping=True,
        return_overflowing_tokens=True,
        truncation="longest_first",
        padding="max_length",
        return_tensors="pt",
        max_length=512,
        stride=0,
        return_length=True,
    )
    # Input IDs and attention mask
    input_ids = tokenizer_out["input_ids"]
    attention_mask = tokenizer_out["attention_mask"]

    # Inference with the mask
    model.eval()
    outputs = model(input_ids, attention_mask=attention_mask)

    print(outputs)


if __name__ == "__main__":
    main()
image

and every time I try and step into the code from the transformers library, I get brought back to my own masking_exploration.py module. I have to click the Show 2 More Stack Frames under the Call Stack, and then go back into the code in the transformers library.

@Ujifman
Copy link

Ujifman commented Jun 11, 2024

Got the same issue after update VSCode to 1.90.0.
Workaround: downgrade VSCode to 1.89.1
Here is full VSCode about screen of version where step in other libraries is working

Version: 1.89.1 (system setup)
Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
Date: 2024-05-07T05:13:33.891Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631

@BriceBoy
Copy link

BriceBoy commented Jun 11, 2024

Same problem here

VS Code Version 1.90.0
Debugpy Version v2024.6.0
Python Version 3.12.2
OS Windows

@dyitzchaki-roku
Copy link

downgrading just the extension doesn't help

@d-biehl
Copy link

d-biehl commented Jun 11, 2024

very good! Thanks for the info!

@Andrej730
Copy link

Is there way to safely downgrade to VS Code 1.89.1 besides just uninstalling and installing it? Is there any chance to lose some settings/data during reinstall?

@avishek-mondal
Copy link

avishek-mondal commented Jun 12, 2024

Is there way to safely downgrade to VS Code 1.89.1 besides just uninstalling and installing it? Is there any chance to lose some settings/data during reinstall?

I don't think there is :( I kept a copy of ~/Library/Application\ Support/Code/User and ~/.vscode/extensions (I use a Mac) to preserve my settings and keybindings before I deleted VSCode 1.9 and installed 1.89

@avi-nextvestment
Copy link

avi-nextvestment commented Jun 13, 2024

I am running into the same issue. Making it impossible to debug anything

Even with this extension setting disabled:
image

VS Code Version 1.90.0
Debugpy Version v2024.6.0
Python extension v2024.8.0
Python Version 3.10.11
OS Windows

@avi-nextvestment
Copy link

avi-nextvestment commented Jun 13, 2024

Found this is a duplicate of microsoft/debugpy#1598 and ultimately a VS Code issue that's documented here: microsoft/vscode#214433'

FYI: A fix has been released in v1.90.1 which is available here: https://code.visualstudio.com/insiders/ but note this is not a stable release yet

@paulacamargo25
Copy link
Contributor

Closed in: #214433

@Andrej730
Copy link

Andrej730 commented Jun 13, 2024

I'm on insiders version, can confirm that it now seems to work as before.

Version: 1.91.0-insider (user setup)
Commit: 0a417782b1781d39803b8f1791cfb22f8835ddae
Date: 2024-06-13T05:48:47.964Z
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests