Skip to content
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

Pylance not starting, Pylance: report issue...` doesn't work #7011

Open
hrl20 opened this issue Feb 23, 2025 · 7 comments
Open

Pylance not starting, Pylance: report issue...` doesn't work #7011

hrl20 opened this issue Feb 23, 2025 · 7 comments
Assignees
Labels
needs repro Issue has not been reproduced yet waiting for user response Requires more information from user

Comments

@hrl20
Copy link

hrl20 commented Feb 23, 2025

SincePylance: report issue... doesn't work, i've created an issue under vscode-python through Python: report issue...
microsoft/vscode-python#24839
Here's a copy of the report


Type: Bug

Behaviour

Pylance intellisense is completely not working (go to reference/definition even for the standard python library).

Running the Python: Restart Language server command results in command 'python.analysis.restartLanguageServer' not found

After selecting an interpreter (./.venv/bin/python), opening a terminal shows
Python virtual environment was successfully activated, even though "(.venv)" indicator may not be present in the terminal prompt. Learn more. However, if I try to call python it would still fail zsh: command not found: python

I've tried uninstall and reinstalling the extensions at least 10 times. Including deleting the python-related folders from the ~/.vscode/extensions folder.

Now i'm trying the disable/reenable/unintsall/reinstall loop again, and this time, when i click enable in the Python extension, i get this error about Pylance:

notificationsAlerts.ts:40 Error: Cannot enable 'Pylance' extension because it depends on 'Python' extension that cannot be enabled
    at R3e.L (extensionEnablementService.ts:181:12)
    at R3e.J (extensionEnablementService.ts:157:8)
    at R3e.setEnablement (extensionEnablementService.ts:207:10)
    at async Lit.nc (extensionsWorkbenchService.ts:2925:10)

Developer tools sometimes has some error message: notificationsAlerts.ts:42 Sorry, something went wrong activating IntelliCode support for Python. Please check the "Python" and "VS IntelliCode" output windows for details. c @ notificationsAlerts.ts:42

Steps to reproduce:

Just install the regular Python + Python debugger + Pylance. Try selecting interpreter. Observe everything fail miserably.

Extension version: 2025.0.0
VS Code version: Code 1.97.2 (Universal) (e54c774e0add60467559eb0d1e229c6452cf8447, 2025-02-12T23:20:35.343Z)
OS version: Darwin arm64 22.6.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.11
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Jedi"

Installed Extensions
Extension Name Extension Id Version
cmake twx 0.0.17
cmake-tools ms- 1.20.52
copilot Git 1.272.0
copilot-chat Git 0.24.1
cpptools ms- 1.23.6
cpptools-extension-pack ms- 1.3.0
cpptools-themes ms- 2.0.0
gitlens eam 16.3.2
go gol 0.44.0
intellicode-api-usage-examples Vis 0.2.9
java red 1.39.0
js-debug ms- 1.97.1
js-debug-companion ms- 1.1.3
jupyter ms- 2025.1.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.0
python ms- 2025.0.0
rust-analyzer rus 0.3.2308
vscode-gradle vsc 3.16.4
vscode-java-debug vsc 0.58.1
vscode-java-dependency vsc 0.24.1
vscode-java-pack vsc 0.29.0
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-maven vsc 0.44.0
vscode-mojo mod 25.1.1
vscode-tailwindcss bra 0.14.6
vscodeintellicode Vis 1.3.2
System Info
Item Value
CPUs Apple M2 Max (12 x 2400)
GPU Status 2d_canvas: enabled
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
Load (avg) 2, 2, 3
Memory (System) 32.00GB (0.10GB free)
Process Argv --crash-reporter-id ce3d937f-6e61-4cb4-ad2a-b73c62e87442
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
f8hc8238:30694864
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc1:31192215
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31242946
customenabled:31241370
hdaa2157:31222309
copilot_t_ci:31222730
jda6j935:31233686


Environment data

  • Pylance version: 2025.2.1
  • OS version: Darwin arm64 22.6.0
  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.11 (/opt/homebrew/bin/python3.11)

Code Snippet

Try to run Pylance: report issue...
See this in devtools

workbench.desktop.main.js:sourcemap:711 [Extension Host] stack trace: Error: command 'python.viewLanguageServerOutput' not found
    at f3e.n (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1288:1341)
    at f3e.executeCommand (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1288:1273)
Ats @ workbench.desktop.main.js:sourcemap:711
$logExtensionHostMessage @ workbench.desktop.main.js:sourcemap:711
S @ workbench.desktop.main.js:sourcemap:3242
Q @ workbench.desktop.main.js:sourcemap:3242
M @ workbench.desktop.main.js:sourcemap:3242
L @ workbench.desktop.main.js:sourcemap:3242
(anonymous) @ workbench.desktop.main.js:sourcemap:3242
B @ workbench.desktop.main.js:sourcemap:29
fire @ workbench.desktop.main.js:sourcemap:29
fire @ workbench.desktop.main.js:sourcemap:732
l.onmessage @ workbench.desktop.main.js:sourcemap:3253
workbench.desktop.main.js:sourcemap:34   ERR command 'python.viewLanguageServerOutput' not found
@hrl20
Copy link
Author

hrl20 commented Feb 23, 2025

For posterity, I looked at the Python extension outputs, and found out that the extension picked up some really old, no longer functional python installation in my environment.

Send text to terminal: /usr/local/bin/python3.5 <home>/.vscode/extensions/ms-python.python-2025.0.0-darwin-arm64/python_files/printEnvVariablesToFile.py <home>/.vscode/extensions/ms-python.python-2025.0.0-darwin-arm64/python_files/deactivate/zsh/envVars.txt
2025-02-23 15:24:20.245 [info] Starting Pylance language server.
2025-02-23 15:24:49.497 [error] Failed to initialize deactivate script /opt/homebrew/bin/zsh Error: "<home>/.vscode/extensions/ms-python.python-2025.0.0-darwin-arm64/python_files/deactivate/zsh/envVars.txt" file not created
    at Timeout.<anonymous> (<home>/.vscode/extensions/ms-python.python-2025.0.0-darwin-arm64/out/client/extension.js:2:311758)
    at listOnTimeout (node:internal/timers:581:17)
    at processTimers (node:internal/timers:519:7)

Removing the bad python installation allowed the extension pick up an actually valid python to start the language server.

I have never had to look at extension outputs until this, and so it didn't occur to me that they actually existed in the output tabs. IMO, that was a clear error message that should have been surfaced to the user.

@bruecksen
Copy link

@hrl20 I have the same issue only with a new project. In my old projects the language server is working. I also tried to setup a clean project. It has the same issue. Python interpreter is selected but pylance is not starting. Anyone any idea what i can do to make this work?

@hrl20
Copy link
Author

hrl20 commented Feb 27, 2025

@bruecksen have you checked the Python extension output in the output tab?

@bruecksen
Copy link

bruecksen commented Feb 27, 2025

@hrl20 i don't have Python extension as an option in the output tab. Only Extension Host. Do you mean that? If i compare my Python output to the project where it is working it is missing the activation of the environment.

Python output (pylance not working)
2025-02-27 08:21:12.451 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-02-27 08:21:12.451 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-02-27 08:21:12.451 [info] Experiment 'pythonTestAdapter' is active
2025-02-27 08:21:12.451 [info] Native locator: Refresh started
2025-02-27 08:21:12.451 [info] Native locator: Refresh started
2025-02-27 08:21:12.508 [info] Python interpreter path: ~/.virtualenvs/ut/bin/python
Python output (pylance working)
2025-02-27 08:21:12.897 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-02-27 08:21:12.897 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-02-27 08:21:12.897 [info] Experiment 'pythonTestAdapter' is active
2025-02-27 08:21:12.897 [info] Native locator: Refresh started
2025-02-27 08:21:12.908 [info] > pyenv which python
2025-02-27 08:21:12.908 [info] cwd: .
2025-02-27 08:21:14.527 [info] Python interpreter path: ~/.virtualenvs/lifelessons/bin/python
2025-02-27 08:21:14.885 [info] > . ~/.virtualenvs/lifelessons/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.1.2025022501-darwin-arm64/python_files/printEnvVariables.py
2025-02-27 08:21:14.885 [info] shell: bash
2025-02-27 08:21:14.924 [info] > /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2025.1.2025022501-darwin-arm64/python_files/printEnvVariables.py
2025-02-27 08:21:14.924 [info] shell: bash
...

@hrl20
Copy link
Author

hrl20 commented Feb 27, 2025

this is slightly different from my issue i think. i would try removing ~/.virtualenvs/ut/bin/python, if they were the same issue.

@bruecksen
Copy link

@hrl20 hmm ok. it sounded more or less the same. Is your language server starting do you see this in the python output? I tried all the different python environments. New ones, existing ones. nothing helped.

@debonte debonte transferred this issue from microsoft/pylance-release Feb 27, 2025
@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode-python Mar 4, 2025
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Mar 4, 2025
@debonte
Copy link
Contributor

debonte commented Mar 4, 2025

@hl20, can this issue be closed? The vscode-python team is looking at microsoft/vscode-python#24839 which seems like a duplicate of this issue to me.

@debonte debonte added the waiting for user response Requires more information from user label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet waiting for user response Requires more information from user
Projects
None yet
Development

No branches or pull requests

4 participants