You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
"launch" doesn't work with venv on Windows and Python 3.7+ #1930
Extension version (available under the Extensions sidebar): 2019.11.49689
OS and version: Windows 10 Pro 1909
Python version (& distribution if applicable, e.g. Anaconda): 3.7.4
Type of virtual environment used: pipenv or poetry. Happens on both
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.
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.
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.
changed the title [-]Session-1 timed out waiting for debuggee to spawn[/-][+]"launch" doesn't work with venv on Windows and Python 3.7+[/+]on Nov 19, 2019
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!
Activity
int19h commentedon Nov 19, 2019
The difference in command line indicates that one environment is using ptvsd 4.x, and the other one is 5.x.
int19h commentedon Nov 19, 2019
Do you see this working correctly if a virtual environment is not used?
int19h commentedon Nov 19, 2019
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.
[-]Session-1 timed out waiting for debuggee to spawn[/-][+]"launch" doesn't work with venv on Windows and Python 3.7+[/+]vdurante commentedon Nov 20, 2019
I will answer all 3 of your messages
Thank you for the fast response
int19h commentedon Nov 20, 2019
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!
Fix microsoft#1930: "launch" doesn't work with venv on Windows and Py…
Fix microsoft#1930: "launch" doesn't work with venv on Windows and Py…
Fix microsoft#1930: "launch" doesn't work with venv on Windows and Py…
vdurante commentedon Dec 3, 2019
Thank you very much Pavel Minaev (@int19h). I am glad I could help.
siben168 commentedon Dec 6, 2019
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
karthiknadig commentedon Dec 7, 2019
Eric (@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.
siben168 commentedon Dec 11, 2019
Karthik Nadig (@karthiknadig) great! it works for me, thank you so much.
dwaynewei commentedon Mar 31, 2020
hey guys, I got a similar issue. and I got no answers while googled it. pls help me if any of you guys knows how to solve it. thx a lot.

karthiknadig commentedon Mar 31, 2020
Dwayne (@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.
int19h commentedon Mar 31, 2020
Dwayne (@dwaynewei), what you're seeing is a different issue: microsoft/debugpy#84 - we're still working on it.