-
Notifications
You must be signed in to change notification settings - Fork 68
"launch" doesn't work with venv on Windows and Python 3.7+ #1930
Comments
The difference in command line indicates that one environment is using ptvsd 4.x, and the other one is 5.x. |
Do you see this working correctly if a virtual environment is not used? |
Ah, I think I see what the issue is.
The adapter is expecting the connecting debug server to has PID=2524, because that's the PID of the process that it spawed. Instead, it gets a connection from PID=13056, which is a child of 2524. This happens because on Windows, starting with Python 3.7.2, venv now uses a lightweight stub for python.exe, which spawns the actual python.exe from the base interpreter as a child. |
I will answer all 3 of your messages
Thank you for the fast response |
You did nothing wrong - this is definitely a bug, and a high-priority one at that - so a fix will be coming soon. The comment was there to record the results of the preliminary investigation. Thank you for bringing it to our attention, and for the logs that allowed it to be diagnosed so quickly! |
…thon 3.7+ For "launch", match processes on parent PID as a fallback for PID, to accommodate launcher stubs like py.exe.
…thon 3.7+ For "launch", match processes on parent PID as a fallback for PID, to accommodate launcher stubs like py.exe.
…thon 3.7+ For "launch", match processes on parent PID as a fallback for PID, to accommodate launcher stubs like py.exe.
Thank you very much @int19h. I am glad I could help. |
i saw this ticket has been closed, but how can i get updated on VS Code? I am using the latest Code but this issue still exists. Thanks |
@siben168 Try the insiders build of the extension: https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix . Tonight's build has the debugger with the fix. |
@karthiknadig great! it works for me, thank you so much. |
@dwaynewei Can you file a separate bug? It is likely that you are running into microsoft/vscode-python#10843 but we will need more data. |
@dwaynewei, what you're seeing is a different issue: microsoft/debugpy#84 - we're still working on it. |
Environment data
Expected behaviour
Being able to debug the application
Actual behaviour
Popup shows message
Session-1 timed out waiting for debuggee to spawn
(debugee as it is written)I have also noticed an odd behavior. Testing on 2 machines with the same setup, the terminal command for running the same program runs very differently.
Machine with the issue:
Machine without the issue:
Steps to reproduce:
Even the simplest program wont debug if it is running from a virtual environment.
Tried with or without activation.
Tried running on CMD or PS.
Tried running on integratedTerminal, externalTerminal, internalConsole.
Tried running on poetry and pipenv.
Reinstalled python and extension. Cleared all python, pipenv, virtualenv, poetry, and extension files and folders across the computer.
All combinations failed.
Logs
terminal.txt
settings.json
launch.json
ptvsd.launcher-7012.log
ptvsd.adapter-8744.log
debugger.vscode_482d787f-1202-4275-ad01-2e93f7e025ed.log
ptvsd.server-13056.log
The text was updated successfully, but these errors were encountered: