microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.32k stars 1.18k forks source link

Timeout waiting for debugger connection when using Windows PowerShell #2732

Closed F8F-Bearcat closed 6 years ago

F8F-Bearcat commented 6 years ago

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:

  1. open hello.py file
  2. click on debug spider symbol on left vertical bar

Logs

Output for Python in the Output panel (ViewOutput, 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.

adibarman commented 6 years ago

Same issue after Windows 10 latest update.

DonJayamanne commented 6 years ago

@matvelloso

Please could you create a separate GitHub issue. The issue you are facing is un-related to conda. (You are facing this issue even without conda). here's your python path: "pythonPath":"/home/travis/virtualenv/python3.7-dev/bin/python","args":

matvelloso commented 6 years ago

Sorry but isn't that the general case for most people here? It looks like the general pattern is folks who installed the latest win update and now can't debug, regardless whether they are using conda?

graywolfcorp commented 6 years ago

same issue - can run the python script fine by right clicking and running in terminal, but debugging times out.

Setting console to "none" allows debugger to start but none of the path info seems present.

Traceback (most recent call last): File "C:\Users\park\Anaconda3\lib\site-packages\numpy\core__init__.py", line 16, in from . import multiarray ImportError: DLL load failed: The specified module could not be found.

Debugging works fine through Anaconda Navigator using Spyder

{ "name": "Python: Terminal (none)", "type": "python", "request": "launch", "program": "${file}", "console": "none"
}

DonJayamanne commented 6 years ago

Hi Everyone, please could you try the following:

Reload VS Code, try debugging again. Please upload screenshots of the terminal along with any error messages received.

JeppeDruedahl commented 6 years ago

I can run the debugger when I change my default shell to command prompt (instead of PowerShell).

Disabling the auto-activation is not necessary for me.

HughGrovesArup commented 6 years ago

Changing default shell to command prompt sorted the problem for me as well.

DonJayamanne commented 6 years ago

@matvelloso

Sorry but isn't that the general case for most people here? It looks like the general pattern is folks who

Apologies, yes. agreed

graywolfcorp commented 6 years ago

Changing shell to command prompt fixed the issue for me.

matkoh commented 6 years ago

confirmed, change to default shell appears to fix the (windows update related) issue.

ghost commented 6 years ago

Had the exact same problem, DonJayamanne's solution worked for me!

lrStyle commented 6 years ago

Same issue in the Mac OS X latest version. And problem solved after changing version to 1.23.1. So maybe this issue doesn't only exit in win latest version.

DonJayamanne commented 6 years ago

@lrStyle

Same issue in the Mac OS X latest version.

Please could you provide a screenshot of the error message and the terminal output.

And problem solved after changing version to 1.23.1

Version of what software?

matvelloso commented 6 years ago

FYI Switching to command line on my VS Code on win 10 seems to have solved the issue too

lrStyle commented 6 years ago

Hi Don, thanks for your response. This is my screenshot of error message:

screen shot 2018-10-11 at 23 29 11

And below is the output of terminal: LrrrdeMacBook-Pro:IMDB lrrr$ cd /Users/lrrr/Desktop/IMDB ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /usr/local/bin/python3 /Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd_launcher.py 56763 /Users/lrrr/Desktop/IMDB/code.py Hello World Traceback (most recent call last): File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py", line 3, in from _pydevd_bundle_ext.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, set_additional_thread_info, global_cache_skips,global_cache_frame_skips ModuleNotFoundError: No module named '_pydevd_bundle_ext' During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py", line 9, in from _pydevd_bundle.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, set_additional_thread_info, global_cache_skips, ModuleNotFoundError: No module named '_pydevd_bundle.pydevd_cython'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py", line 17, in from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo, set_additional_thread_info File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_cython_wrapper.py", line 40, in mod = import(check_name) ModuleNotFoundError: No module named '_pydevd_bundle.pydevd_cython_darwin_37_64'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevconsole.py", line 9, in from code import InteractiveConsole ImportError: cannot import name 'InteractiveConsole' from 'code' (/Users/lrrr/Desktop/IMDB/code.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd_launcher.py", line 85, in import ptvsd File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/init.py", line 13, in from ._vendored import force_pydevd File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/force_pydevd.py", line 40,in 'pydevd', File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/init.py", line 123, inpreimport import_module(name) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevd.py", line 29, in from _pydevd_bundle.pydevd_additional_thread_info import set_additional_thread_info File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info.py", line 19, in from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo, set_additional_thread_info # @UnusedImport File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py", line 7, in from _pydevd_bundle.pydevd_frame import PyDBFrame File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py", line 11, in from _pydevd_bundle.pydevd_comm import CMD_STEP_CAUGHT_EXCEPTION, CMD_STEP_RETURN, CMD_STEP_OVER, CMD_SET_BREAK, File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 89, in import pydevconsole File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevconsole.py", line 11, in from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole File "/Users/lrrr/.vscode/extensions/ms-python.python-2018.9.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevconsole_code_for_ironpython.py", line 105 except SyntaxError, err: ^ SyntaxError: invalid syntax

Internal error detected. Please copy the above traceback and report at https://github.com/Microsoft/vscode-python/issues/new

And after I uninstalled the 1.28 of Mac OS and changed the version to 1.23 of Mac OS, there is no such problem.

wpilgri commented 6 years ago

Confirmation that command prompt solved the issue. Latest windows 10 and Anaconda v1.9.2

PCJimmmy commented 6 years ago

Not smart enough to change to the command shell.

But

Disable auto-activation of the terminal. Go into settings.json and add the following setting: "python.terminal.activateEnvironment": false

This Worked! I am back and running - thanks

elfayoumi commented 6 years ago

I got the same problem, and it seems to be due to conda env,

jdobrzen commented 6 years ago

Changing to default shell to cmd worked as well.

To change default shell: 1) File -> Preferences -> Settings 2) Search "Terminal" 3) Find a setting with an option to "Edit in settings.json" 4) Search for "terminal.integrated.shell.windows" 5) In the window on the right for User Settings change value from PowerShell path to cmd "C:\windows\System32\cmd.exe"

PCJimmmy commented 6 years ago

Thanks – the thread suggested both actions – but I was not smart enough to change the default shell. This helps.

Sent from Mail for Windows 10

From: Jonathan Dobrzeniecki Sent: Thursday, October 11, 2018 10:36 PM To: Microsoft/vscode-python Cc: PCJimmmy; Comment Subject: Re: [Microsoft/vscode-python] Python Timeout waiting for debuggerconnection when using Anaconda (#2732)

Changing to default shell to cmd worked as well. To change default shell:

  1. File -> Preferences -> Settings
  2. Search Terminal
  3. Find a setting with an option to "Edit in settings.json"
  4. Search for "terminal.integrated.shell.windows"
  5. In the window on the right for User Settings change value from PowerShell path to cmd "C:\windows\System32\cmd.exe" — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
DonJayamanne commented 6 years ago

@PCJimmmy

I'm a little confused. Are you saying that changing the shell to cmd is what fixed the issue or was it disabling auto activation?

PCJimmmy commented 6 years ago

In the GitHub for the extension discussion it was indicated that changing the shell and disabling auto should be tried. Folks seemed to report that one or both fixed things for them. For me, I could not figure out how to change the shell and only did the one action. But it fixed it for me. Seems like either or both might work, but I am still using the powershell on two machines that were broke and are now fixed by way of disable auto-activation.

Don’t understand why its an either or both or just one fix – they don’t seem that related to me, but guess if you dig into the extension coding you might be able to make sense of why either works.

When I later tried to follow Jonathan D directions for changing the shell I found that I had no terminal.integrated.shell.windows – it was a .linux only. This was on my machine that I did a 100% clean reinstall of windows, anaconda and vs code. For fear of breaking things again I left the shell change for another day.

Jim

Sent from Mail for Windows 10

From: Don Jayamanne Sent: Friday, October 12, 2018 12:12 AM To: Microsoft/vscode-python Cc: PCJimmmy; Mention Subject: Re: [Microsoft/vscode-python] Python Timeout waiting for debuggerconnection when using Anaconda (#2732)

@PCJimmmy I'm a little confused. Are you saying that changing the shell to cmd is what fixed the issue or was it disabling auto activation? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ninja-asa commented 6 years ago

As suggested, switching from Powershell to cmd OR disabling auto activation solved the issue for me.

srirambm commented 6 years ago

still not working same problem tried chaning powershell as well as disabled auto activation as suggested above. Python 3.6.5 :: Anaconda, Inc.

srirambm commented 6 years ago

guess will have to go back to spyder :-(

elfayoumi commented 6 years ago

You need to go back to version 1.27 the bug is with 1.28. It seems not working with env, if you use root anaconda without any environment, it works

PCJimmmy commented 6 years ago

Tried Spyder yesterday – I had forgotten how visually challenging it was.

Seems to be some difference of opinion as to the cause – VS Code closed this issue today saying it’s the extension. I almost ran the test for you of using 1.27 as I mucked up my machine so bad trying to fix this issue that I needed a clean windows install. Was going to install 1.27 (download is easy to find) but the fix worked on my second machine before I reached that point in the process of reinstall – mess up my machine so often I am getting real good at the long process to get Python back running tensorflow and keras with dual GPU. Did not look to see if I could install the previous version of the extension.

The extension, vs code and windows all seemed to like Oct 9th for update day – so not clear in my mind where the issue lies. If I was still having issues guess I would be on GitHub for the extension.

Sent from Mail for Windows 10

From: srirambm Sent: Friday, October 12, 2018 10:21 AM To: Microsoft/vscode-python Cc: PCJimmmy; Mention Subject: Re: [Microsoft/vscode-python] Python Timeout waiting for debuggerconnection when using Anaconda (#2732)

guess will have to go back to spyder :-( — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

DonJayamanne commented 6 years ago

@elfayoumi @ninja-asa @jdobrzen @wpilgri @matvelloso @lorossee @matkoh @graywolfcorp @HughGrovesArup @F8F-Bearcat @ColombianViking @2Dews @conorfos @demo16

I'd like to rule out Powershell as the cause:

matvelloso commented 6 years ago

In my test, the problem remained the same. Only actually switching to command prompt fixes it.

graywolfcorp commented 6 years ago

Above changes reverted to prior debugger error not finding path - Win 10

Exception has occurred: ImportError Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try git clean -xdf (removes all files not under version control). Otherwise reinstall numpy. Original error was: DLL load failed: The specified module could not be found.

vsdebug

PCJimmmy commented 6 years ago

Don

I have two machines running 1.28.1 The first is a very clean (last night) install of win 10, anaconda python. Its still contains Powershell and disabled auto-activation.

The second also 1.28.1 (both using the Oct 9 Python extension) – its not as clear – playing around I got my current running script using the Python Debug Console – stills have Powershell but its not the active terminal. Likely 12 hours away from that running script terminating – but will confirm things running with Powershell. But on machine 1 if I start with powershell as terminal as soon as I hit f5 to run script terminal switches to Python Debug Console.

I just went into json settings on the first machine – removed the disable auto-activation and its broken again. Press F5 and I get this output in the terminal – followed in 20-30 seconds with the timeout dialog.

Put disable back into json settings – and back to working.

To break it after removing I did need to unload and reload VS Code. To fix it, just needed to make the json change and save.

Jim

Sent from Mail for Windows 10

From: Don Jayamanne Sent: Friday, October 12, 2018 11:02 AM To: Microsoft/vscode-python Cc: PCJimmmy; Mention Subject: Re: [Microsoft/vscode-python] Python Timeout waiting for debuggerconnection when using Anaconda (#2732)

@elfayoumi @ninja-asa @jdobrzen @wpilgri @matvelloso @lorossee @matkoh @graywolfcorp @HughGrovesArup @F8F-Bearcat @ColombianViking @2Dews @conorfos @demo16 I'd like to rule out Powershell as the cause: • Please could you ensure you have Powershell as your default shell in VSCode • Next disable auto-activation of the terminal. Go into settings.json and add the following setting: "python.terminal.activateEnvironment": false • Try debugging once again Please let me know whether this fix alone works. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

srirambm commented 6 years ago

Ok thanks. will try. I just shited to Vs code and am not aware of the full history.

regards

[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& 10/12/18, 9:21:49 PM

On Fri, Oct 12, 2018 at 7:52 PM Ibrahim El-Fayoumi notifications@github.com wrote:

You need to go back to version 1.27 the bug is with 1.28.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode-python/issues/2732#issuecomment-429343017, or mute the thread https://github.com/notifications/unsubscribe-auth/AFada_7ClHuLCH5hAhLANJHKg9RaVpBwks5ukKWlgaJpZM4XA1ui .

-- Balaraman Sriram

ninja-asa commented 6 years ago

@DonJayamanne

Yes, only by disabling the auto-activation of the environment I stop getting the error aforementioned "Timeout waiting for debugger connection"

    "python.terminal.activateEnvironment": false,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
HughGrovesArup commented 6 years ago

Same settings as @ninja-asa work for me

srirambm commented 6 years ago

@DonJayamanne

Yes, only by disabling the auto-activation of the environment I stop getting the error aforementioned "Timeout waiting for debugger connection"

    "python.terminal.activateEnvironment": false,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

Nope just went back to 1.27.2 changed settings as mentioned restarted and getting the same timeout error

srirambm commented 6 years ago

I can get debugger and everything fine if I change my python interpreter to something else other than any of conda environments

brettcannon commented 6 years ago

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**

capture

ninja-asa commented 6 years ago

@brettcannon The settings/versions/code I am using and consequent debugging ability and screenshot are like the ones you shared.

graywolfcorp commented 6 years ago

Default Shell set to Command Prompt

I need to either exclude the python.terminal.activateEnvironment setting or have it set to true in order for debugging to work.

VS Code: 1.28.1 Python Extension: 2018.9.0 Windows 10: Windows 10 Pro 1809 Powershell: PS 5.1.17763.1 Python: 3.7.0 Python Environment: conda 4.5.1 "python.terminal.activateEnvironment": true

Debugging works: Y

VS Code: 1.28.1 Python Extension: 2018.9.0 Windows 10: Windows 10 Pro 1809 Powershell: PS 5.1.17763.1 Python: 3.7.0 Python Environment: conda 4.5.1 "python.terminal.activateEnvironment": false

Debugging works: N

launch.json

    {
        "name": "Python",
        "type": "python",
        "request": "launch",            
        "console": "integratedTerminal",
        "program": "${file}",
    },

vsdebug

DonJayamanne commented 6 years ago

@graywolfcorp

Please could you try debugging a simple print("hello") statement with Powershell. Right now, importing numpy, etc is a different issue. We're trying to figure out the Debugger Timeout connection issue.

graywolfcorp commented 6 years ago

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"
}, psfalse pstrue

PCJimmmy commented 6 years ago

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.

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.
DonJayamanne commented 6 years ago

@PCJimmmy

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")

timeregained commented 6 years ago

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 true N

image

brettcannon commented 6 years ago

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 commented 6 years ago

just 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

brettcannon commented 6 years ago

@Beta3-Data yes, but it won't activate your conda environment either which many people want/expect.

srirambm commented 6 years ago

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.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 commented 6 years ago

@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.