vscode-python: Gets stuck at "Python extension loading" then extension host crashes when `telemetry.enableTelemetry` is set to `false`

There’s a few other mentions of this but no fixes so far.

Environment data

  • VS Code version: Noticed after upgrade to 1.52, kept happening after downgrade to 1.51.
  • Extension version (available under the Extensions sidebar): v2020.12.422005962
  • OS and version: Windows 10 2004
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9, same on 3.91
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: All
  • Relevant/affected Python-related VS Code extensions and their versions: Base Python extension
  • Value of the python.languageServer setting: Pylance

Expected behaviour

Message disappears and extension eventually loads.

Actual behaviour

Message doesn’t disappear, extension doesn’t load, “Extension host terminated unexpectedly” message appears.

Steps to reproduce:

  1. Start VSCode
  2. Select a python file to trigger the extension loading.

Was also able to reproduce after separately:

  • reinstalling VScode
  • recreating %userprofile%.vscode
  • recreating %appdata%\Code
  • Updating python to 3.91
  • Enabling only the Python extension

Logs

Total output of OUTPUT > Python. Extension host crashes after it sits at this for a while.

Info 2020-12-15 16:12:53: Searching for workspace virtual envs in: d:\users\ben\Documents\advent-of-code-2020
Info 2020-12-15 16:12:53: Searching for workspace virtual envs in: d:\users\ben\Documents\advent-of-code-2020\.direnv
Info 2020-12-15 16:12:53: Searching for global virtual envs in: C:\Users\Ben\Envs
Info 2020-12-15 16:12:53: Searching for global virtual envs in: C:\Users\Ben\.direnv
Info 2020-12-15 16:12:53: Searching for global virtual envs in: C:\Users\Ben\.venvs
Info 2020-12-15 16:12:53: Searching for global virtual envs in: C:\Users\Ben\.virtualenvs
Info 2020-12-15 16:12:53: Searching for global virtual envs in: C:\Users\Ben\.local\share\virtualenvs
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPLcf'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 15
  • Comments: 74 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I had same issue too


Version: 1.56.0 (user setup) Commit: cfa2e218100323074ac1948c885448fdf4de2a7f Date: 2021-05-04T22:09:06.405Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.19041

Python : 3.8.10


  1. Reinstall python extension
  2. Open setting.json and add that word "telemetry.enableTelemetry": false
  3. Restart program, !complete

Hi all,

You can temporarily fix this by adding following User setting as a workaround:

"python.experiments.optInto": ["pythonDiscoveryModuleWithoutWatcher"]

But in order to fix it properly, we need more info:

  • Please send the User settings.
  • The first few lines of the output channel contains text like User belongs to experiment group which are important to us: image Please provide the above info before using the workaround, thanks!

Experiencing this too. It seems that it is a regression in the latest release. It causes a memory leak on my Windows 10 machine (memory usage spikes up to 2-3 GB) and the status bar shows “Python extension loading” forever.

I have to downgrade to the previous version because of this.

There seems to be many duplicates of this in the last few hours

Well, I’d rather not enable telemetry globally. I hope this issue is getting fixed soon. The extension should be functional without experiment framework.

Thank you, I’m able to reproduce this. Both of your settings, tim-settings.txt & abhi-settings.txt have a setting in common: telemetry.enableTelemetry set to false. Removing that setting fixes the issue for me!

It seems VSCode disables the experiment framework if telemetry is disabled, so you were opted out of the discovery experiment.

@kmsbio "telemetry.enableTelemetry": false the reason that works is because disabling telemetry also disables the experiments. You can instead specifically disable python.experiment.optOutFrom: ["pythonDiscoveryModule", "pythonDiscoveryModuleWithoutWatcher"].

I recommend filing bug with cpu profile and any other details with pythonDiscoveryModuleWithoutWatcher on. So we can figure out what is going on with that. That module will soon replace the existing discovery module.

The extension should be functional without experiment framework.

Yes, we plan to remove the non-experiment code which should fix this issue for you.

Thank you, @karrtikr I confirm that removing telemetry.enableTelemetry fixes the issue.

Mine has User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher' if "python.experiments.optInto": ["pythonDiscoveryModuleWithoutWatcher"] is set manually. Otherwise none at all.

Same problem here, disabling telemetry did not help, I use insider Python (daily) and insider Pylance (daily).

I have to enable 2 settings for this to work, not only telemetry.enableTelemetry:

{
  "telemetry.enableCrashReporter": true,
  "telemetry.enableTelemetry": true,
}

I am also observing issues on v2020.12.424452561. I uninstalled Python, Pylance, and Jupyter, quit VS Code, and deleted all of them from my filesystem. Upon reinstalling them, the extension host immediately crashed.

I just removed the Python (ms-python.python) extension, which just got updated to version v2020.12.422005962 and manually reinstalled v2020.11.371526539, and now it is working just fine. The v2020.12 got released 18 hrs ago, so there is probably a bug there.

I had set "python.experiments.disabled": true, and "python.experiments.optOutFrom": ["All"],. Setting these broke the discovery of my tests and stuck “Python extension loading” permanently at the bottom of my window.

When I removed them from my (user) settings.json, things were fixed.

Props to @Timsonrobl for providing me enough insight 😃

PS: Am posting this in case someone comes from google trying to find out why their Python extension doesn’t load and why vscode can’t find their tests :p

Also experiencing infinite loading of the Python extension v2021.9.1230869389 right now. My settings.json is empty. There is a python.exe (3.9.5 x64) in my PATH, and also a venv in my current folder. I do not use Conda anywhere, don’t get, why it’s in the log below.

Output of Python

User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModulecf'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'pythonFindInterpreter'
User belongs to experiment group 'PythonPyTorchProfiler'
> conda --version
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> py -3.7 -c "import sys;print(sys.executable)"
> py -3.6 -c "import sys;print(sys.executable)"
> py -3 -c "import sys;print(sys.executable)"
> py -2 -c "import sys;print(sys.executable)"
> c:\path\to\folder\.venv\Scripts\python.exe -c "import sys;print(sys.executable)"
> conda info --json

VS Code version

Version: 1.60.0 (user setup)
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:41:52.311Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.18363

Thank you for your work at this extension!

I have the same “Python extension loading forever” issue when using a remote container for development (ssh+docker container on the ssh-host). For me it started working again once I setup a python(+pylance) interpreter on the local host. After that the remote one started working again as well 🤷‍♂️. Idk if this is the real cause though… I’ve been frantically trying configurations and am just glad it is working again 💫 😵 .

Version: 1.55.2 (Universal) Commit: 3c4e3df9e89829dce27b7b5c24508306b151f30d Date: 2021-04-13T09:36:32.643Z Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Darwin x64 20.3.0

(Remote ssh-host on ubuntu 20.04 as root and remote container using docker)

Update 1: it stopped working for me again, even with the local running python extension. I did notice however that vscode seems to confuse containers in regards of extensions. I installed the python extension in one container and saw a notification in a different container that the new extension was installed. So it seems to get something mixed up there. This is all wild guessing though and might have nothing to do with this issue.

Update 2: After more playing around it started working again when I disabled all the “Experiments” in settings. Screenshot 2021-05-05 at 10 04 45 🤷‍♂️ let’s see if it continues to work for longer now.

I had the same issue and disabling telemetry helped. In my case, the remote machine has no internet access. Maybe adding a timeout or proper error handling can fix this issue.

Same issue with Python extension not loading and preventing many other extensions from loading.

Adding "telemetry.enableTelemetry": false to settings.json has solved (or hidden) the issue.

Version: 1.58.0 (user setup) Commit: 2d23c42a936db1c7b3b06f918cde29561cc47cd6 Date: 2021-07-08T06:54:55.083Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.19043

I had the same problem here.

Version: 1.55.2 (user setup) Commit: 3c4e3df9e89829dce27b7b5c24508306b151f30d Date: 2021-04-13T09:35:57.887Z (2 wks ago) Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.18363

venv with Python 3.8.8 64-bit

  1. I solved it by running VSCode in Administrator mode once.
  2. Then I restarted it without administrator mode and it was fixed.

@karrtikr attached please find, hoping it does help. CPU-20210220T220758.224Z.cpuprofile.zip

Ooutput -> Python:

Info 2020-12-15 16:42:30: Searching for workspace virtual envs in: /usr/local/google/home/zhangkelvin/aosp
Info 2020-12-15 16:42:30: Searching for workspace virtual envs in: /usr/local/google/home/zhangkelvin/aosp/.direnv
Info 2020-12-15 16:42:30: Searching for global virtual envs in: /usr/local/google/home/zhangkelvin/Envs
Info 2020-12-15 16:42:30: Searching for global virtual envs in: /usr/local/google/home/zhangkelvin/.direnv
Info 2020-12-15 16:42:30: Searching for global virtual envs in: /usr/local/google/home/zhangkelvin/.venvs
Info 2020-12-15 16:42:30: Searching for global virtual envs in: /usr/local/google/home/zhangkelvin/.virtualenvs
Info 2020-12-15 16:42:30: Searching for global virtual envs in: /usr/local/google/home/zhangkelvin/.local/share/virtualenvs
Info 2020-12-15 16:42:30: Searching for global virtual envs in: /usr/local/google/home/zhangkelvin/envs
User belongs to experiment group 'AlwaysDisplayTestExplorer - control'
User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonSendEntireLineToREPL'
Error 2020-12-15 16:42:30: Failed to resolve symbolic link:  [Error: ENOENT: no such file or directory, lstat 'python2'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: 'python2'
}
> conda --version
> pyenv root
> python3.7 ~/.vscode-server/extensions/ms-python.python-2020.12.424027540/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-server/extensions/ms-python.python-2020.12.424027540/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-server/extensions/ms-python.python-2020.12.424027540/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2020.12.424027540/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode-server/extensions/ms-python.python-2020.12.424027540/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3.7 ~/.vscode-server/extensions/ms-python.python-2020.12.424027540/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json

Settings.json:

{
    "python.formatting.autopep8Args": [
        "--indent-size=2"
    ],
    "search.exclude": {
        "**/*.o": true,
        "out": true,
        "prebuilts": true
    },
    "search.followSymlinks": false,
    "editor.wordWrap": "bounded",
    "telemetry.enableTelemetry": false,
    "gitlens.advanced.telemetry.enabled": false,
    "iwyu.exe": "/usr/bin/iwyu",
    "editor.tabSize": 2,
    "editor.suggest.insertMode": "replace",
    "remote.autoForwardPorts": false
}

I removed python extension, removed copies of it in ~/.vscode-server/extensions , but still running into the same problem after re-installing python extension.

Running the new version 2020.12.424027540 but still experiencing the same issue.

We just released another version (2020.12.424027540) with a potential fix for this issue. Please try it out, and let us know.