-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python interpreter loading stuck #24324
Comments
@ruihangdu Can you try running "Python: Clear Cache and Reload"? You can clear any changes you did to |
Ok I'm now seeing some different errors: Python Output
|
@ruihangdu Can you try the pre-release version of the extension? Can you also check your settings and see if there is anything there that points to a non-existing environment? |
I did check my settings, but didn't see anything standing out. Is there any specific part of the setting I should take a deeper look at? |
Check |
In my VSCode settings, condaPath is empty, I didn't quite find pythonPath, and I updated to defaultInterpreterPath to python3, which points to
I installed the pre-release version and I saw the following log:
But I still don't see any log line that indicates Pylance has been loaded, and intellisense is still not working. |
Tis is strange. What do you see in Output > Python Locator? Also, open Help > Toggle Developer Tools and share any errors you see there. |
Output > Python Locator
|
@ruihangdu What do you have for the @rchiodo Any ideas on what might be going on here? As far as I can tell, from the latest logs there, we are finding and picking up the python. But somehow, pylance is not starting. |
I've been having this problem myself. (#24211) It happens if a python interpreter is selected that isn't available anymore. There's no log entry for starting of Pylance either, so I would assume it's stalling on the extension side. |
my python.languageServer is Pylance |
@ruihangdu Can you force a selection? run the Select Interpreter command and select/re-select the python you want to use. see if that helps. |
tried it. Didn't really help |
I am running into the same problem, which seems to happen only after version 2024.10.0. Version 2024.8.1 doesn't bring about this issue. Tested on
|
I tried again today after updating everything including:
I saw the following console output from Python extension:
But I'm still not getting Python IntelliSense in my vscode. |
I think I had the same issue: Pylance unavailable (Command python.analysis.restartLanguageServer not found), which I traced back to "Discovering Python interpreters" hanging. I had no setting for In the end I think I resolved it by removing old conda envs that were Python 2.7-based and removing some old .virtualenvs that I had lost sight of. My hypothesis is that the new discovery mechanism is a bit less backward-tolerant than it used to be - but there may be more going on of course. Versions:
Python trace: unsuccessful2025-01-21 14:37:45.378 [info] Experiment 'pythonRecommendTensorboardExt' is active 2025-01-21 14:37:45.378 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2025-01-21 14:37:45.378 [info] Experiment 'pythonTestAdapter' is active 2025-01-21 14:37:45.378 [warning] Dir "/Users/peter/Mycode/nicegui/crud_db/.pixi/envs" is not watchable (directory does not exist) 2025-01-21 14:37:45.378 [info] Starting Environment refresh 2025-01-21 14:37:45.378 [info] Searching for interpreters in posix paths locator 2025-01-21 14:37:45.378 [info] Searching for pyenv environments 2025-01-21 14:37:45.378 [info] Searching for conda environments 2025-01-21 14:37:45.378 [info] Searching for global virtual environments 2025-01-21 14:37:45.378 [info] Searching for custom virtual environments 2025-01-21 14:37:45.378 [info] pyenv is not installed 2025-01-21 14:37:45.378 [info] Finished searching for pyenv environments: 9 milliseconds 2025-01-21 14:37:45.378 [info] Finished searching for custom virtual envs: 9 milliseconds 2025-01-21 14:37:45.378 [info] > ~/miniconda3/bin/conda info --json 2025-01-21 14:37:45.378 [info] > hatch env show --json 2025-01-21 14:37:45.378 [info] cwd: . 2025-01-21 14:37:45.378 [info] > pyenv which python 2025-01-21 14:37:45.378 [info] cwd: . 2025-01-21 14:37:45.380 [info] Found: /usr/bin/python3 --> /usr/bin/python3 2025-01-21 14:37:45.535 [info] Found: /usr/local/bin/python3 --> /usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/bin/python3.13 2025-01-21 14:37:45.541 [info] Found: /usr/local/bin/python3.10 --> /usr/local/Cellar/[email protected]/3.10.16/Frameworks/Python.framework/Versions/3.10/bin/python3.10 2025-01-21 14:37:45.549 [info] Found: /usr/local/bin/python3.12 --> /usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/bin/python3.12 2025-01-21 14:37:45.552 [info] Found: /usr/local/bin/python3.13 --> /usr/local/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/bin/python3.13 2025-01-21 14:37:45.565 [info] Found: /usr/local/bin/python3.9 --> /usr/local/Cellar/[email protected]/3.9.21/Frameworks/Python.framework/Versions/3.9/bin/python3.9 2025-01-21 14:37:45.571 [info] Found: /Users/peter/miniconda3/bin/python --> /Users/peter/miniconda3/bin/python3.12 2025-01-21 14:37:45.571 [info] Found: /Users/peter/miniconda3/bin/python3 --> /Users/peter/miniconda3/bin/python3.12 2025-01-21 14:37:45.571 [info] Found: /Users/peter/miniconda3/bin/python3.1 --> /Users/peter/miniconda3/bin/python3.12 2025-01-21 14:37:45.571 [info] Found: /Users/peter/miniconda3/bin/python3.12 --> /Users/peter/miniconda3/bin/python3.12 2025-01-21 14:37:45.930 [info] > ~/miniconda3/envs/nicegui/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:45.932 [info] > ~/miniconda3/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:45.949 [info] Finished searching for conda environments: 588 milliseconds 2025-01-21 14:37:45.955 [info] Finished searching for global virtual envs: 594 milliseconds 2025-01-21 14:37:45.965 [info] > ~/miniconda3/envs/build/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:45.971 [info] Finished searching for interpreters in posix paths locator: 611 milliseconds 2025-01-21 14:37:45.971 [info] Environments refresh paths discovered (event): 611 milliseconds 2025-01-21 14:37:45.971 [info] Environments refresh paths discovered: 611 milliseconds 2025-01-21 14:37:45.991 [info] > ~/miniconda3/envs/django22/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:45.992 [info] Python interpreter path: ~/miniconda3/envs/nicegui/bin/python 2025-01-21 14:37:46.035 [info] > ~/miniconda3/envs/gpx2exif/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.067 [info] > ~/miniconda3/envs/jp/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.127 [info] > ~/miniconda3/envs/jupy/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.138 [info] > ~/miniconda3/envs/jupybook/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.195 [info] > ~/miniconda3/envs/jupyhub/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.238 [info] > ~/miniconda3/envs/jupylab/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.283 [info] > ~/miniconda3/envs/marielle_life/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.318 [info] > ~/miniconda3/envs/mkdocs/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.388 [info] > ~/miniconda3/envs/new/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.408 [info] > ~/miniconda3/envs/ng_alarm/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.487 [info] > ~/miniconda3/envs/ng_verkeer/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.513 [info] > ~/.virtualenvs/django18rest/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.574 [info] > ~/miniconda3/envs/nicegui-dev/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.667 [info] > ~/miniconda3/envs/oxxa/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.728 [info] > ~/miniconda3/envs/qsp/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.740 [info] > ~/miniconda3/envs/rbac/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.741 [info] > ~/miniconda3/bin/conda run -n qsp --no-capture-output python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.814 [info] > ~/miniconda3/envs/rolemining/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.873 [info] > ~/miniconda3/envs/sphinx/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:46.942 [info] > ~/.virtualenvs/flask/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:37:47.686 [error] [Error: Command failed: /Users/peter/miniconda3/bin/conda run -n qsp --no-capture-output python -I /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py Unknown option: -I usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Try `python -h' for more information. ERROR conda.cli.main_run:execute(125): `conda run python -I /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py` failed. (See above for error) at genericNodeError (node:internal/errors:984:15) at wrappedFn (node:internal/errors:538:14) at ChildProcess.exithandler (node:child_process:423:12) at ChildProcess.emit (node:events:530:35) at maybeClose (node:internal/child_process:1104:16) at Socket. (node:internal/child_process:456:11) at Socket.emit (node:events:518:28) at Pipe. (node:net:343:12)] { code: 2, killed: false, signal: null, cmd: '/Users/peter/miniconda3/bin/conda run -n qsp --no-capture-output python -I /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py' } Python trace: successful2025-01-21 14:45:18.061 [info] Experiment 'pythonRecommendTensorboardExt' is active 2025-01-21 14:45:18.061 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2025-01-21 14:45:18.061 [info] Experiment 'pythonTestAdapter' is active 2025-01-21 14:45:18.061 [warning] Dir "/Users/peter/Mycode/nicegui/crud_db/.pixi/envs" is not watchable (directory does not exist) 2025-01-21 14:45:18.061 [info] Starting Environment refresh 2025-01-21 14:45:18.061 [info] > hatch env show --json 2025-01-21 14:45:18.061 [info] cwd: . 2025-01-21 14:45:18.061 [info] Python interpreter path: ~/miniconda3/envs/nicegui/bin/python 2025-01-21 14:45:18.061 [info] > ~/miniconda3/bin/conda info --json 2025-01-21 14:45:18.760 [info] > ~/miniconda3/envs/nicegui/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/interpreterInfo.py 2025-01-21 14:45:18.761 [info] Environments refresh paths discovered: 720 milliseconds 2025-01-21 14:45:18.804 [info] Environments refresh finished (event): 763 milliseconds 2025-01-21 14:45:18.805 [info] Environment refresh took 764 milliseconds 2025-01-21 14:45:18.806 [info] > pyenv which python 2025-01-21 14:45:18.806 [info] cwd: . 2025-01-21 14:45:18.817 [info] > ~/miniconda3/bin/conda info --json 2025-01-21 14:45:18.817 [info] shell: bash 2025-01-21 14:45:19.240 [info] > ~/miniconda3/bin/conda run -n nicegui --no-capture-output python ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/printEnvVariables.py 2025-01-21 14:45:19.240 [info] shell: bash 2025-01-21 14:45:19.862 [info] Starting Pylance language server. 2025-01-21 14:45:20.263 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/printEnvVariables.py 2025-01-21 14:45:20.263 [info] shell: bash 2025-01-21 14:45:20.367 [info] Setting environment variable _CE_M in collection to {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable CONDA_ROOT in collection to /Users/peter/miniconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable CONDA_PREFIX in collection to /Users/peter/miniconda3/envs/nicegui {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (nicegui) {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable _CE_CONDA in collection to {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable XPC_SERVICE_NAME in collection to 0 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to nicegui {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Prepending environment variable PATH in collection to /Users/peter/.npm-packages/bin:node_modules/.bin:/Users/peter/miniconda3/envs/nicegui/bin:/Users/peter/miniconda3/condabin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/peter/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/git/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Setting environment variable CONDA_PREFIX_1 in collection to /Users/peter/miniconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2025-01-21 14:45:20.367 [info] Prepending environment variable PS1 in collection with (nicegui) {"applyAtShellIntegration":true,"applyAtProcessCreation":false} 2025-01-21 14:45:20.367 [info] Send text to terminal: /usr/bin/python3 /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/printEnvVariablesToFile.py /Users/peter/.vscode/extensions/ms-python.python-2024.22.2-darwin-arm64/python_files/deactivate/bash/envVars.txt |
@kleynjan After resolving it were you able to use IntelliSense in your VSCode? |
Well technically I don't think it's Intellisense, but yes, when I got rid of the error discovering/restarting the python server I had signature-based popups etc working again. |
....and today the same issue was back again. "Discovering interpreters" is not the problem this time, but still I get the "command not found" for the language server. I added the 'python.locator' value 'js', which did nothing, then the value 'native' and then... it worked again. The VScode Python environment really gets more broken by the day. |
The issue "command 'python.analysis.restartLanguageServer' not found" keeps reappearing, despite having cleaned up old envs. :-( MacOS, MS Python, Pylance and Ruff. All up to date. I can often (but not completely reliably) resolve it by:
It's driving me crazy that Python / Pylance configuration should be so brittle. |
Type: Bug
Behaviour
When I load a Python project in vscode, I would see a "Discovering Python Interpreters" spin wheel on the bottom left corner of the window indefinitely, and I cannot use any intellisense features on the python file, including finding references & function definitions. I saw a bunch of errors in the Python extension output log about not being able to find miniconda3 path (I do not have miniconda installed on the machine anymore) but not sure if those are red herrings.
I have tried the suggestions in #23956 to change "Python Locator" from "native" to "js" but that didn't work, so reaching out for help. Thank you!
Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Extension version: 2024.16.1
VS Code version: Code 1.94.2 (Universal) (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z)
OS version: Darwin arm64 22.6.0
Modes:
python.languageServer
setting: PylanceUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: