Repository navigation
Timeout waiting for debugger connection when using Windows PowerShell #2732
Description
Activity
OK, so I added settings.json in .vscode
my python.pythonPath in settings.json in .vscode looks like this:
"python.pythonPath": "C:\PyAna2\envs\pandas36\python.exe",No change in the timeout behavior - still does not connect and times out
Also, this is Windows 10 professional release 10.0.17134
Dug into conda location.
I have conda.bat located in C:\PyAna2\Library\bin
I also have C:\PyAna2\Library\bin on my path- Please could you confirm the following file exists:
C:\PyAna2\envs\pandas36\python.exe - Please modify settings.json to add the file path as follows:
"python.pythonPath": "C:\\PyAna2\\envs\\pandas36\\python.exe",
Note, this is a JSON file hence back slashes need to be encoded.
-
Instead of manually editing the
settings.json, please could you select a python interpreter from the UI.
Either use the commandPython: Select Interpreteror use click on the status bar item (eitherPlease Select Interpreteror<Some Python Interpreter Information> -
Finally, please try install the latest development version of the extension from here and give it a go. https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build
- Please could you confirm the following file exists:
- addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
on Sep 30, 2018 When I loaded settings.json, the double backslashes had already been changed / fixed.
"python.pythonPath": "C:\PyAna2\envs\pandas36\python.exe",
Tried debugger connection - still a timeout and no connection
Finally, I tried the insiders VSIX file, it did not load.
Got this error message:
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:2407 Sorry, something went wrong activating IntelliCode support for Python. Please check the "VS IntelliCode" output window for details.
I used View:Toggle Output a couple of times but am not seeing anything in the output window that is helpful. I'm cycling through Problems / Output / Debug Console / Terminal "tabs" and also all combinations of the pulldown on the right.
Tried to connect debugger again, no connection.
How would I uninstall the VSIX file?
Please send a screen shot of the contents in settings.json
To install the vsix, just uninstall the python extension and quit vscode.I was testing for issue #2698 and faced similar issue with in-development build vsix. F5 started the debugger for Python-Flask debug config, it gets hung. Similarly with Python-Current File debug config, if any of the module imports fails, exception is not shown on the terminal, but the debugger get hung.
I pressed Ctrl+C to break, and got the below stack
Traceback (most recent call last):
File "c:\Users\abcd.vscode\extensions\ms-python.python-2018.8.1-beta\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd_pydevd_bundle\pydevd_frame.py", line 649, in trace_dispatch
self.do_wait_suspend(thread, frame, event, arg)
File "c:\Users\abcd.vscode\extensions\ms-python.python-2018.8.1-beta\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd_pydevd_bundle\pydevd_frame.py", line 134, in do_wait_suspend
self._args[0].do_wait_suspend(*args, **kwargs)
File "c:\Users\abcd.vscode\extensions\ms-python.python-2018.8.1-beta\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd\pydevd.py", line 827, in do_wait_suspend
time.sleep(0.01)
KeyboardInterruptVS Code version 1.27.2
Python extension: latest development build, if any of the module imports fails
Please elaborate on this. How do you know about this failure,
- Please debug a simple python program with a for loop
- Debug and seen screen shot of error message and contents of the terminal window
Next:
- Please right click on the file and select the context menu option
Run Python File in Terminal, let me know what you get in there.
Finally, I tried the insiders VSIX file, it did not load.
Please disable Intelli-code for now (or just uninstall it). and try again.
92 remaining items
for print("hello")
Default Shell set to Powershell
"python.terminal.activateEnvironment": trueDebugging works: N - timeout
Default Shell set to Powershell
"python.terminal.activateEnvironment": falseDebugging works: Y
Default Shell set to cmd
"python.terminal.activateEnvironment": falseDebugging works: Y
Default Shell set to cmd
"python.terminal.activateEnvironment": trueDebugging works: Y
launch.json
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},

Reacted by Don Jayamanne- Brett Two machines – both showing identical response – both running a long script that I don’t want to kill at the present. Both have been running VS pretty continuously for the last couple weeks. #1 – had the issue with this one first. It was standard Win 1803 when it occurred – submitted a issue a couple of days ago that was closed too quickly in my view – I have since done a full clean install completed last night including a full fresh conda and python install. Not sure what level of VS or extension I was at when it first went bad. I made a big mess of it trying to fix which lead to the decision to fresh install. Simple refresh did not work as all the Anaconda stuff part of my user files, which were retained in a refresh. Full clean install taken to wipe all of that out. I did nothing on either machine with regards to the terminal type – always been default powershell. 1.28.1 2018.9.0 Windows 10 1803 Python 3.7.0 conda 4.5.11 ‘false’ - works like a charm. - default No entry following clean install it did not work. - removed the false line – no longer works after a reload of VS – until than its OK - add false back in – works fine again without the need to reload VS #2 – issue just arose yesterday after I did a reboot. Can’t recall the last previous reboot. This machine on Win 10 fast track and has had 1809 since 9/15/2018 OS build 17758.1 So for my machines the issue has nothing to do with the October release of Win 10 and everything to do with the VS and extension updates. 1.28.0 2018.9.0 Win 10 1809 Python 3.6.5 conda 4.5.11 ‘false’ – works like a charm. Sent from Mail for Windows 10 From: Brett Cannon Sent: Friday, October 12, 2018 12:26 PM To: Microsoft/vscode-python Cc: PCJimmmy; Mention Subject: Re: [Microsoft/vscode-python] Timeout waiting for debugger connectionwhen using Windows PowerShell (#2732) We believe there are two issues going on (PowerShell not activating fast enough under conda to get the debug command, and a potential issue related to the Windows 10 October 2018 release regardless of environment activation), and due to the amount of comments here it has become hard for us to tell what configurations are leading to failures. If people can provide the following it would be really helpful: 1. The information listed in the table below (I will update it as people's responses come in) 2. A screenshot of the failure (please try to capture your status bar so we can see the Python details as well as the terminal output) A massive thanks to anyone able to provide details regarding this! VS Code version Python extension version Windows 10 version ("About your PC") PowerShell version (`$PSVersionTable.PSVersion`) Python version Python environment Environment activation (`"python.terminal.activateEnvironment"`) Debugging works 1.28.1 2018.9.0 Windows 10 1803 PS 5.1 17134 Python 3.7.0 venv `true` Y 1.28.1 2018.9.0 Windows 10 1803 PS 5.1 17134 Python 3.7.0 conda 4.5.11 `false` Y 1.28.1 2018.9.0 Windows 10 1803 PS 5.1 17134 Python 3.7.0 conda 4.5.11 `true` **N** — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Two machines – both showing identical response – both running a long script that I don’t want to kill at the present.
Please could you try running a new simple script such as
print("Hello")Same issues repeated on 3 different PC.
All the configuration are all the same as below:
VS Code version Python extension version Windows 10 version ("About your PC") PowerShell version ( $PSVersionTable.PSVersion)Python version Python environment Environment activation ( "python.terminal.activateEnvironment")Debugging works 1.28.1 2018.9.0 Windows 10 1709 PS 5.1 16299 Python 3.7.0 conda 5.3 trueN Thanks to everyone for the help! We're fairly certain we have eliminated the Windows 10 October 2018 worry and corroborated that this is all because our hack around conda's lack of PowerShell support just isn't robust enough based on the APIs that VS Code provides us. We are going to get a fix out that will let you know that conda + PowerShell are not a good combination for debugging (conda should have the support necessary in conda 4.6). We will also make it easy to switch your terminal over to command prompt so that you can still debug with an activated conda environment. Otherwise you can disable environment activation and stick with PowerShell if you prefer while still being able to debug.
Reacted by Sofia AssisHassanAbbas92 commented
on Oct 16, 2018 More actionsjust open the lauch.json file and add the following configuration:
{ "name": "Python: Debug Console", "type": "python", "request": "launch", "program": "${file}", "console": "none" }When you specify "none" for the console, it will run the debugger in the debugger console instead of running in the internal or external terminal.
And it will work@Beta3-Data yes, but it won't activate your conda environment either which many people want/expect.
just open the lauch.json file and add the following configuration:
{ "name": "Python: Debug Console", "type": "python", "request": "launch", "program": "${file}", "console": "none" }just did this and issue continues, I have set two things
activate environment to false
added the above into launch.jsonam I the only one with the issue, please I see others have closed it.
I am trying to use python for testing azure functions other than using C#.
and thought vs code with its deep integration will be useful.Sriram Muthukrishnan (@srirambm) if you are using conda w/ PowerShell then either don't use conda or switch to Command Prompt. If you're not using conda w/ PowerShel then you have a different issue.
- locked as resolved and limited conversation to collaborators
on Oct 17, 2018




Environment data
Actual behavior
with a simple hello world - click on debugger selection and green run debug symbol, timeout occurs waiting for debugger connection
Expected behavior
Expecting debugger to connect
Steps to reproduce:
Logs
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Output from
Consoleunder theDeveloper Toolspanel (toggle Developer Tools on underHelp)OK, opening the ticket, as Brett suggested was a good idea. I had no idea this was the way to get a error message to trigger off of. I searched the error and found a similar issue. There were several questions there which I will answer here.
Conda install location: C:\PyAna2
.vscode/settings.json, what is python.pythonPath value? I find no settings.json file there, extensions only
Conda env list:
(pandas36) C:\Users\Free Agent>conda env list
conda environments:
base C:\PyAna2
pandas36 * C:\PyAna2\envs\pandas36
pdf27 C:\PyAna2\envs\pdf27
Path:
(pandas36) C:\Users\Free Agent>path
PATH=C:\PyAna2\envs\pandas36;C:\PyAna2\envs\pandas36\Library\mingw-w64\bin;C:\PyAna2\envs\pandas36\Library\usr\bin;C:\PyAna2\envs\pandas36\Library\bin;C:\PyAna2\envs\pandas36\Scripts;C:\PyAna2\envs\pandas36\bin;C:\PyAna2;C:\PyAna2\Library\mingw-w64\bin;C:\PyAna2\Library\usr\bin;C:\PyAna2\Library\bin;C:\PyAna2\Scripts;C:\PyAna2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\HashiCorp\Vagrant\bin;C:\Program Files\PuTTY;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Users\Free Agent\AppData\Local\Microsoft\WindowsApps;C:\Users\Free Agent\AppData\Local\GitHubDesktop\bin;C:\Users\Free Agent\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\Users\Free Agent\AppData\Local\Microsoft\WindowsApps;
So looks like I should start with the fact there is no settings.json file in .vscode?
I also don't have "conda" on the path, though I do have the conda environments on the path.