'how to configure Vscode to debug Python using WSL?
I found the configuration for cpp (https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Debugger/gdb/Windows%20Subsystem%20for%20Linux.md) and tried to change it for python debugging but it doesn't work. Any suggestion to make it work?
Solution 1:[1]
It should be mentioned that the Python extension for VS Code does not officially support WSL yet, but the enhancement request has been made and we do plan on supporting it.
Solution 2:[2]
This is now supported and just requires installing the Microsoft Python extension and following the documentation here.
Solution 3:[3]
Beyond extensions installations, IDE_PROJECT_ROOTS environment variable also may affect the debugger. For usual WSL standalone python code debugging, making sure this variable is not set (or set to the location of the files) when the VS code is opened helps.
For "step into" debugging of jupyter notebook having the python files path(s) as a part of IDE_PROJECT_ROOTS (for example export IDE_PROJECT_ROOTS="/tmp:/foo_pythonfilespath"
set in .bashrc) will help to carry out "step into" python-code debugging in VSCode.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Brett Cannon |
Solution 2 | Adam Cooper |
Solution 3 | William |