Runaway Jedi : Language task in VSCode 2023 :
Every time I close VSCode (after running some Python script) I have a Python task that lingers in my terminal running 90-100% CPU on my M1 MacBook Air, and I have to manually kill it every time. I ran the following on the PID:
ps aux | grep <PID>
and it returns the same thing every time…
Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python /Users/<user>/.vscode/extensions/ms-python.python-2021.2.625869727/pythonFiles/runJediLanguageServer.py
I checked my VSCode extensions, and I don’t have any “Jedi” ones installed, but maybe it’s a lingering task from some other extension. Any ideas how to fix this?
It seems like there might be a lingering task related to the Jedi language server in your VSCode workspace. The Jedi language server is a language server for Python, and it’s used by various Python extensions in VSCode to provide code intelligence and completion.
To resolve this issue, you can try the following steps:
- Check Installed Extensions: Even though you mentioned that you don’t have any “Jedi” extensions installed, it’s possible that another Python-related extension might be using Jedi internally. Check your installed extensions for any Python-related extensions and disable or uninstall them to see if the issue persists.
- Update Python Extension: Ensure that you have the latest version of the “Python” extension installed in VSCode. Sometimes, updating the extension can help resolve issues with lingering tasks.
- Reset VSCode Settings: If the issue persists, you can try resetting your VSCode settings to the default state. Open the Command Palette (press
Cmd + Shift + P
on macOS), and type “Preferences: Open Settings (JSON)”. This will open thesettings.json
file. Remove any settings related to Python or Jedi. For example, remove any lines containing"python.pythonPath"
or"python.jediEnabled"
. - Clear Language Server Cache: The Jedi language server might have cached some data that is causing the issue. Try clearing the language server cache by following these steps:
- Close VSCode.
- Open the terminal and navigate to your VSCode workspace folder.
- Delete the
.vscode
folder and the.vscode-server
folder.
- Disable Language Server: If none of the above steps work, you can try disabling the Jedi language server entirely. Open the Command Palette and type “Python: Select Interpreter”. This will show a list of available Python interpreters. Choose one that doesn’t use Jedi. For example, you can choose a virtual environment or a different Python installation that uses a different language server.
- Debug Extensions: If the issue persists and you suspect a specific extension is causing the problem, you can try debugging the extensions. Open the Extensions view in VSCode, click on the gear icon, and choose “Extension Host Debug”. This will open a new window where you can see debug output from the extensions. Look for any errors or messages related to Jedi or Python extensions.
After trying these steps, restart VSCode and see if the lingering task issue is resolved. If the problem persists, consider reaching out to the VSCode community or the developers of the Python extension for further assistance.