microsoft / ptvsd

Python debugger package for use with Visual Studio and Visual Studio Code.
Other
548 stars 68 forks source link

Unable to step into inside conda env, python debugger #2106

Closed greatsharma closed 4 years ago

greatsharma commented 4 years ago

I am using python debugger inside conda env. I set the pythonPath to the conda env bin location. When I using python debugger step into is not working, it is not opening the file to which I want to step into. Here I placed a breakpoint at line 46 and when I click step into it should ideally go into __call__ method inside /home/winter_soilder/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py but it directly goes to line 22 of the forward function. vscode

settings.json ->

{
    "python.pythonPath": "/home/winter_soilder/anaconda3/envs/pytorch/bin/python",
    "python.autoComplete.extraPaths": [
        "/home/winter_soilder/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch",
        "/home/winter_soilder/anaconda3/envs/pytorch/lib/python3.8/site-packages/torchvision"
    ]
}

lauch.json ->

{
    // 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: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}
karthiknadig commented 4 years ago

@greatsharma To debug inside site-packages add "justMyCode": false to your debug configuration in launch.json.

greatsharma commented 4 years ago

@karthiknadig thanks a lot it's now working like a charm :)