Cannot debug using a custom Python interpreter
See original GitHub issueLikely to be fixed by PR in #8856 - in that issue’s comments it was speculated this issue is caused by a timeout while validating the Python interpreter.
Environment data
- VS Code version: 1.53.0
- Extension version (available under the Extensions sidebar): v2021.2.531887795-dev (as suggested in #8856)
- OS and version: openSUSE Tumbleweed 20210205
- Python version (& distribution if applicable, e.g. Anaconda): 2.7.18, custom distribution
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Value of the
python.languageServer
setting: jedi (but also tried MS and pylance with the same results)
Expected behaviour
Python debug processes work fine
Actual behaviour
I use a custom Python interpreter that takes 2-3 seconds to come up due to its extensive bootstrapping. When trying to start a debug configuration, I always get the error message “The Python path in your debug configuration is invalid.”. The log shows Invalid Python Path ‘/home/XXX/YYY/ZZZ/bin/CUSTOM’.
Up until recently, I was using vscode-python 2019.9.1, which seems to be the latest version that works with my custom interpreter. Now, VSCode January 2021 seems to break compatibility with the older vscode-python:
Debugger Error: The number of constructor arguments in the derived class s must be >= than the number of constructor arguments of its base class.
If I use the custom interpreter to start a debugpy
process in another terminal and connect to it with a debug configuration, everything works just fine.
Steps to reproduce:
I can’t distribute the custom interpreter. But it should be rerproducible with vanilla Python if you can introduce a small lag in the bootstrap process.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
For anyone else running into this issue here is a work around. It is not ideal, but it will allow you to work with custom pythons that write to
stderr
.debugpy
shipped with the extension. It should be<HOME>\.vscode\extensions\ms-python.python-*\pythonfiles\lib\python\debugpy\adapter
.python debugpy/adapter --port 5678
You can use other
"request": "launch"
configurations, as long as you have"debugServer": <port>
We exit if anything gets written into
stderr
when getting python info: https://github.com/Microsoft/vscode-python/blob/db8e1e2460e9754ec0672d958789382b6d15c5aa/src/client/pythonEnvironments/info/interpreter.ts#L68This results in validation failure here https://github.com/Microsoft/vscode-python/blob/48d66bd5b2943f155a9d63a1b951628c15831c1d/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts#L88
Which eventually result in the message that you see.