Repository navigation
Timeout waiting for debugger connection when using Windows PowerShell #2732
Description
Environment data
- VS Code version: 1.27.2
- Extension version (available under the Extensions sidebar): 2018.8.0
- OS and version: Windows 10 professional release 10.0.17134
- Python version (& distribution if applicable, e.g. Anaconda): Anaconda 2.7 with Python 3.6.5 conda virtual environment
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
- Relevant/affected Python packages and their versions: simple helloworld.py no imports
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:
- open hello.py file
- click on debug spider symbol on left vertical bar
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
##########Linting Output - pylint##########
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
INFO no standard startup: panel is active
console.ts:136 [Extension Host] vscode-icons is active!
console.ts:136 [Extension Host] Git extension API method 'getGitPath' is deprecated.
t.log @ console.ts:136
console.ts:136 [Extension Host] Python Extension: Failed to get conda environment list from conda Error: spawn conda ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
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
>
(pandas36) C:\Users\Free Agent>conda list
# packages in environment at C:\PyAna2\envs\pandas36:
#
# Name Version Build Channel
arrow 0.12.1 py36_2 conda-forge
arrow-cpp 0.9.0 py36_vc14_7 [vc14] conda-forge
asn1crypto 0.24.0 py36_0
astroid 2.0.4 <pip>
backcall 0.1.0 py36_0
binaryornot 0.4.4 py_1 conda-forge
bleach 2.1.3 py36_0
blinker 1.4 py36_0
bokeh 0.12.15 py36_0
boost-cpp 1.66.0 vc14_1 [vc14] conda-forge
ca-certificates 2018.8.24 ha4d7672_0 conda-forge
certifi 2018.8.24 py36_0 conda-forge
cffi 1.11.5 py36h945400d_0
chardet 3.0.4 py36h420ce6e_1
chardet 3.0.4 <pip>
click 6.7 py36hec8c647_0
cloudpickle 0.5.2 py36_1
colorama 0.3.9 py36h029ae33_0
cookiecutter 1.6.0 py36_0 conda-forge
cryptography 2.2.2 py36hfa6e2cd_0
cycler 0.10.0 py36h009560c_0
cytoolz 0.9.0.1 py36hfa6e2cd_0
dask 0.17.2 py36_0
dask-core 0.17.2 py36_0
datashape 0.5.4 py36h5770b85_0
decorator 4.3.0 py36_0
distributed 1.21.6 py36_0
entrypoints 0.2.3 py36hfd66bb0_2
et_xmlfile 1.0.1 py36h3d2d736_0
feather-format 0.4.0 py36_vc14_2 [vc14] conda-forge
freetype 2.8.1 vc14_0 [vc14] conda-forge
future 0.16.0 py36_2 conda-forge
gitdb2 2.0.3 <pip>
GitPython 2.1.9 <pip>
graphviz 2.38.0 4 anaconda
heapdict 1.0.0 py36_2
html5lib 1.0.1 py36h047fa9f_0
icc_rt 2017.0.4 h97af966_0
icu 58.2 vc14_0 [vc14] conda-forge
idna 2.6 py36h148d497_1
idna 2.6 <pip>
intel-openmp 2018.0.0 8
ipykernel 4.8.2 py36_0
ipython 6.3.1 py36_0
ipython_genutils 0.2.0 py36h3c5d0ee_0
ipywidgets 7.2.1 py36_0
isort 4.3.4 <pip>
jdcal 1.4 py36_0
jedi 0.12.0 py36_1
jinja2 2.10 py36h292fed1_0
jinja2-time 0.2.0 py_2 conda-forge
jpeg 9b vc14_2 [vc14] conda-forge
jsonschema 2.6.0 py36h7636477_0
jupyter 1.0.0 py36_4
jupyter_client 5.2.3 py36_0
jupyter_console 5.2.0 py36h6d89b47_1
jupyter_core 4.4.0 py36h56e9d50_0
jupyterthemes 0.19.1 <pip>
kaggle 1.3.8 <pip>
kiwisolver 1.0.1 py36h12c3424_0
lazy-object-proxy 1.3.1 <pip>
lesscpy 0.13.0 <pip>
libpng 1.6.34 vc14_0 [vc14] conda-forge
libsodium 1.0.16 vc14_0 [vc14] conda-forge
libtiff 4.0.8 vc14h04e2a1e_10 [vc14] anaconda
lifelines 0.14.1 <pip>
llvmlite 0.22.0 py36ha794a7c_0
locket 0.2.0 py36hfed976d_1
lxml 4.2.1 <pip>
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markdown 2.6.11 py_0 conda-forge
markupsafe 1.0 py36h0e26971_1
matplotlib 2.2.2 py36_1 conda-forge
mccabe 0.6.1 <pip>
missingno 0.4.0 py_0 conda-forge
mistune 0.8.3 py36hfa6e2cd_1
mkl 2018.0.2 1
mkl_fft 1.0.1 py36h452e1ab_0
mkl_random 1.0.1 py36h9258bd6_0
msgpack-python 0.5.6 py36he980bc4_0
msys2-conda-epoch 20160418 1
multipledispatch 0.5.0 py36_0
nbconvert 5.3.1 py36h8dc0fde_0
nbdime 0.4.1 <pip>
nbformat 4.4.0 py36h3a5bc1b_0
networkx 2.1 py36_0
notebook 5.4.1 py36_0
numba 0.37.0 np114py36hea3a760_0
numpy 1.14.2 py36h5c71026_1
oauthlib 2.1.0 py36_0
odo 0.5.1 py36h7560279_0
olefile 0.45.1 py36_0
openpyxl 2.5.3 py36_0
openssl 1.0.2p hfa6e2cd_1000 conda-forge
packaging 17.1 py36_0
pandas 0.22.0 py36h6538335_0
pandas-datareader 0.6.0 <pip>
pandoc 1.19.2.1 hb2460c7_1 anaconda
pandocfilters 1.4.2 py36h3ef6317_1
parquet-cpp 1.4.0 vc14_0 [vc14] conda-forge
parso 0.2.0 py36_0
partd 0.3.8 py36hc8e763b_0
patsy 0.5.0 py36_0
pickleshare 0.7.4 py36h9de030f_0
pillow 4.2.1 py36hdb25ab2_0 anaconda
pip 18.0 <pip>
pip 9.0.3 py36_0
plotly 2.5.1 py36_0
ply 3.11 <pip>
poyo 0.4.1 py_1 conda-forge
prompt_toolkit 1.0.15 py36h60b8f86_0
psutil 5.4.5 py36hfa6e2cd_0
ptvsd 4.1.3 <pip>
pweave 0.30.2 py36_0 conda-forge
pyarrow 0.9.0 py36_vc14_1 [vc14] conda-forge
pycparser 2.18 py36hd053e01_1
pygments 2.2.0 py36hb010967_0
pyjwt 1.6.4 py36_0
pylint 2.1.1 <pip>
pyopenssl 17.5.0 py36h5b7d817_0
pyparsing 2.2.0 py36h785a196_1
pyqt 5.6.0 py36_2
pysocks 1.6.8 py36_0
python 3.6.5 h0c2934d_0
python-dateutil 2.7.2 py36_0
pytz 2018.4 py36_0
pywinpty 0.5.1 py36_0
pyyaml 3.12 py36h1d1928f_1
pyzmq 17.0.0 py36hfa6e2cd_1
qt 5.6.2 vc14_1 [vc14] conda-forge
qtconsole 4.3.1 py36h99a29a9_0
regex 2018.02.21 py36hfa6e2cd_0
requests 2.18.4 <pip>
requests 2.18.4 py36h4371aae_1
requests-file 1.4.3 <pip>
requests-ftp 0.3.1 <pip>
requests-oauthlib 0.8.0 py36_1
scikit-learn 0.19.1 py36h53aea1b_0
scipy 1.0.1 py36hce232c7_0
seaborn 0.8.1 py36h9b69545_0
selenium 3.11.0 py36_0
send2trash 1.5.0 py36_0
setuptools 39.0.1 py36_0
simplegeneric 0.8.1 py36_2
simplejson 3.15.0 py36hfa6e2cd_0
sip 4.19.8 py36h6538335_0
six 1.11.0 py36h4db2310_1
smmap2 2.0.3 <pip>
snappy 1.1.7 vc14_1 [vc14] conda-forge
sortedcontainers 1.5.10 py36_0
sqlite 3.22.0 vc14_0 [vc14] conda-forge
statsmodels 0.8.0 py36h6189b4c_0
tblib 1.3.2 py36h30f5020_0
terminado 0.8.1 py36_1
testpath 0.3.1 py36h2698cfe_0
tk 8.6.7 vc14hb68737d_1 [vc14] anaconda
toolz 0.9.0 py36_0
tornado 5.0.2 py36_0
traitlets 4.3.2 py36h096827d_0
twython 3.7.0 py36_0
typed-ast 1.1.0 <pip>
urllib3 1.22 py36h276f60a_0
urllib3 1.22 <pip>
vc 14 h0510ff6_3
vs2015_runtime 14.0.25123 3
wcwidth 0.1.7 py36h3d5aa90_0
webencodings 0.5.1 py36h67c50ae_1
wheel 0.31.0 py36_0
whichcraft 0.4.1 py_1 conda-forge
widgetsnbextension 3.2.1 py36_0
win_inet_pton 1.0.1 py36he67d7fd_1
wincertstore 0.2 py36h7fe50ca_0
winpty 0.4.3 vc14_2 [vc14] conda-forge
wrapt 1.10.11 <pip>
xlwt 1.3.0 py36h1a4751e_0
yaml 0.1.7 vc14_0 [vc14] conda-forge
zeromq 4.2.5 vc14_1 [vc14] conda-forge
zict 0.1.3 py36h2d8e73e_0
zlib 1.2.11 vc14_0 [vc14] conda-forge
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.
Activity
F8F-Bearcat commentedon Sep 30, 2018
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
F8F-Bearcat commentedon Sep 30, 2018
Also, this is Windows 10 professional release 10.0.17134
F8F-Bearcat commentedon Sep 30, 2018
Dug into conda location.
I have conda.bat located in C:\PyAna2\Library\bin
I also have C:\PyAna2\Library\bin on my path
DonJayamanne commentedon Sep 30, 2018
C:\PyAna2\envs\pandas36\python.exe"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 command
Python: 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
F8F-Bearcat commentedon Oct 1, 2018
Hi Don, thanks for getting back to me with these suggestions.
Confirmed C:\PyAna2\envs\pandas36\python.exe exists both by file manager and activating the pandas36 environment in conda and running a notebook from that activated environment.
F8F-Bearcat commentedon Oct 1, 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
F8F-Bearcat commentedon Oct 1, 2018
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?
DonJayamanne commentedon Oct 1, 2018
Please send a screen shot of the contents in settings.json
To install the vsix, just uninstall the python extension and quit vscode.
MandarJKulkarni commentedon Oct 2, 2018
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)
KeyboardInterrupt
VS Code version 1.27.2
Python extension: latest development build
DonJayamanne commentedon Oct 2, 2018
MandarJKulkarni
Please elaborate on this. How do you know about this failure,
F8F-Bearcat commentedon Oct 2, 2018
for Mandar: my issue occurs with or without the in-development vsix build
my user settings.json:

my workspace settings.json

DonJayamanne commentedon Oct 2, 2018
F8F-Bearcat
Next:
Run Python File in Terminal, let me know what you get in there.Please disable Intelli-code for now (or just uninstall it). and try again.
92 remaining items
graywolfcorp commentedon Oct 12, 2018
for print("hello")
Default Shell set to Powershell
"python.terminal.activateEnvironment": true
Debugging works: N - timeout
Default Shell set to Powershell
"python.terminal.activateEnvironment": false
Debugging works: Y
Default Shell set to cmd
"python.terminal.activateEnvironment": false
Debugging works: Y
Default Shell set to cmd
"python.terminal.activateEnvironment": true
Debugging works: Y
launch.json


{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
PCJimmmy commentedon Oct 12, 2018
DonJayamanne commentedon Oct 12, 2018
PCJimmmy
Please could you try running a new simple script such as
print("Hello")timeregained commentedon Oct 15, 2018
Same issues repeated on 3 different PC.
All the configuration are all the same as below:
$PSVersionTable.PSVersion)"python.terminal.activateEnvironment")truebrettcannon commentedon Oct 15, 2018
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.
HassanAbbas92 commentedon Oct 16, 2018
just open the lauch.json file and add the following configuration:
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
brettcannon commentedon Oct 16, 2018
@Beta3-Data yes, but it won't activate your conda environment either which many people want/expect.
srirambm commentedon Oct 17, 2018
just did this and issue continues, I have set two things
activate environment to false
added the above into launch.json
am 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.
brettcannon commentedon Oct 17, 2018
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.