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

selecting python interpreter has no effect, lsp server doesn't seem to be up #24839

Open
hrl20 opened this issue Feb 23, 2025 · 3 comments
Open
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority needs spike Label for issues that need investigation before they can be worked on.
Milestone

Comments

@hrl20
Copy link

hrl20 commented Feb 23, 2025

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

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 23, 2025
@hrl20
Copy link
Author

hrl20 commented Feb 23, 2025

hey i noticed i should have reported this issue to Pylance, however when i tried the Pylance: Report Issue command nothing actually pops up.

i also saw that the User Settings captured
languageServer: "Jedi"
However this configuration nowhere to be found in my settings.

But this prompted me to disable the Jupyter extensions. Somehow after that, Pylance seemed to have come online and import symbols started getting resolved. But when i restarted VSCode, Pylance stopped working again.

@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.

@karthiknadig
Copy link
Member

@hrl20 This is a good issue to raise here in the Python extension. We should not be blocking extension load due to bad python environment.

@karthiknadig karthiknadig self-assigned this Feb 24, 2025
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority needs spike Label for issues that need investigation before they can be worked on. and removed triage-needed Needs assignment to the proper sub-team labels Feb 24, 2025
@karthiknadig karthiknadig added this to the March 2025 milestone Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority needs spike Label for issues that need investigation before they can be worked on.
Projects
None yet
Development

No branches or pull requests

2 participants