vscode-python: Extension causes high cpu load due to interpreter discovery
- Issue Type:
Performance
- Extension Name:
python
- Extension Version:
2020.5.80290
- OS Version:
Windows_NT x64 10.0.18362
- VSCode version:
1.45.1
⚠️ Make sure to attach this file from your home-directory:
⚠️C:\Users\cferguson\ms-python.python-unresponsive.cpuprofile.txt
Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 84 (10 by maintainers)
So this is how I temporarily fixed this problem, put this line in your
settings.json
:I had to disable the python extension so I could connect to a liveshare. It hung on loading the extension. Looking at the htop there was a vscode process that looked like it was related to finding the terminal that was taking 100% of a cpu.
Should be fixed with https://github.com/microsoft/vscode-python/pull/17781. Use
Extension: Install from VSIX
command to install the following VSIX: https://github.com/microsoft/vscode-python/suites/4087722570/artifacts/104116878 which has the fix!Just updated to 1.61.0 and this crap started again… The opt-outs are already in place. It gets stuck on “Discovering Python Interpreters”. Trying to use the circuitpython extension. ms-python.python-unresponsive.cpuprofile.txt
It looks like the extension cannot find an interpreter when selecting “open folder” and opening the microcontroller drive. If I copy the files off to a non-external drive it works fine…
This has just started happening to me too. Windows 10 20H2, VS Code 1.53.1 Python extension freezes when trying to join a liveshare. ms-python.python-unresponsive.cpuprofile.txt
For anyone running into this issue, with the latest version of the extension you can try this to see if it helps. Check the
Output
>Python
panel for python logs. Look for lines that say “User belongs to experiment”, see if you can find a line that says “pythondiscoverymodule”:"python.experiments.optInto": ["pythonDiscoveryModule"]
"python.experiments.optOutFrom": ["pythonDiscoveryModule"]
pythondiscoverymodule
reduces the load on the machine by reducing the number of python processes that are run while trying to detect python. This is one of the common causes of High CPU at load time. For most of our users, opting into it has helped. But, given that it is new, there may be issues with that, so do let us know which case you fall into.In case opting into and out of that experiment does not help, then please file a separate bug.
If you opt into the experiment and it does not find some python that you expect it to find, please file that bug as well.
Same problem, Windows 10 1809, VS Code 1.53.2 ms-python.python-unresponsive.cpuprofile.txt
Having the same issue with the Python extension on Macbook Pro. ms-python.python-unresponsive.cpuprofile.txt
I can confirm, just had this issue as well. Disabling the Python extension reduced my cpu load from 100% and unfroze live share.
Lots of thanks!!!
Same issue here with latest VS Code. Python extension starts loading but does not ends:
ms-python.python-unresponsive.cpuprofile.txt Reinstalled VS Code and deleted old settings as described here: https://stackoverflow.com/questions/52461400/how-to-completely-remove-vs-code-setting/52462074
But issue remains.
@mpratscher Noted, thanks.
You actually have telemetry disabled, which effectively means you have opted out of all experiments.
Very interesting, thank you. Just having
works for me.
Extension removed support for opting out of
pythonDiscoveryModuleWithoutWatcher
with2021.10.1317843341
(see https://github.com/microsoft/vscode-python/pull/17563), which is why it started happening now for you guys. But it seems the new discovery code (meaning experimentpythonDiscoveryModuleWithoutWatcher
) was likely buggy going way back.I’ll let you know if I need anything else.
@karrtikr See attached. Still getting stuck at “Discovering Python Interpreters”. Let me know if you need anything else. Debug Output.txt ms-python.python-unresponsive.cpuprofile.txt setting_json.txt
@karrtikr Here you go. Happy to help, so please let me know if there’s anything else you need or want me to try.
Edit: also still getting stuck at “Discovering Python Interpreters”.
ms-python.python-unresponsive.cpuprofile.txt python_output.txt settings_json.txt
@FlantasticDan Thanks for the reply. I went back to 2021.9.1246542782 and it works there too. So it is the most recent update 2021.10.1317843341 causing issues with Circutpython.
@sn0wfa11 I’ve had to revert back to
v2021.8.1159798656
of the Python Extension, in addition to adding the opt-outs, in order to work with the circuit python extension…Thank you very much @karthiknadig !
After trying a lot of actions, your suggestion solved the issue for me !
Suggestion is here.
This setting solved my issue : “python.experiments.optOutFrom”: [“pythonDiscoveryModule”],
Well this is new for me, but here’s the file it seems to want me to give you. I figured if I didn’t upload it my CPU fans would just blow it your way eventually anyways 😉
ms-python.python-unresponsive.cpuprofile.txt
Last update fixed my issue.