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

Python extension is failing to load #23956

Closed
gurmitteotia opened this issue Aug 16, 2024 · 13 comments
Closed

Python extension is failing to load #23956

gurmitteotia opened this issue Aug 16, 2024 · 13 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments

Comments

@gurmitteotia
Copy link

gurmitteotia commented Aug 16, 2024

Type: Bug

Everything was working until yesterday then after some auto updates on my Linux system, python extension is no more loading in VS Code. I tried by creating new conda environment but still facing same issue. I can use/switch conda environment without any issue.

While starting VS Code python extension is generating following error on "python" output windows-

2024-08-16 12:49:39.878 [info] Experiment 'pythonaa' is active
2024-08-16 12:49:39.878 [info] Experiment 'pythonCreateEnvOnPipInstall' is active
2024-08-16 12:49:39.878 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-08-16 12:49:39.878 [info] Experiment 'pythonSurveyNotificationcf' is active
2024-08-16 12:49:39.878 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-08-16 12:49:39.878 [info] Experiment 'pythonTestAdapter' is active
2024-08-16 12:49:39.878 [info] Native locator: Refresh started
2024-08-16 12:49:39.878 [info] Default formatter is set to null for workspace /home/test_user/source/test_prod/test_project
2024-08-16 12:49:39.890 [info] > pyenv which python
2024-08-16 12:49:39.890 [info] cwd: .
2024-08-16 12:49:39.984 [info] Conda environment manager found at: /home/test_user/anaconda3/bin/conda
2024-08-16 12:49:40.016 [info] Native locator: Refresh finished in 591 ms
2024-08-16 12:49:40.025 [error] Python Extension: interpreterManager.refresh [s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
2024-08-16 12:49:40.150 [error] [
'Failed to check whether to display prompt for conda inherit env setting, Class name = v, completed in 1ms, has a falsy return value, Arg 1: Uri:/home/test_user/source/test_prod/test_project, Return Value: undefined',
[s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
]
2024-08-16 12:49:40.150 [error] [
'Failed to intialize conda inherit env prompt, Class name = v, completed in 3ms, has a falsy return value, Arg 1: Uri:/home/test_user/source/test_prod/test_project, Return Value: undefined',
[s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
]
2024-08-16 12:49:40.150 [error] [
'getActivatedEnvironmentVariables, Class name = D, completed in 2ms, has a falsy return value, Arg 1: Uri:/home/test_user/source/test_prod/test_project, Arg 2: undefined, Arg 3: undefined, Arg 4: "/usr/bin/bash"',
[s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
]
2024-08-16 12:49:40.150 [error] Failed to apply terminal env vars undefined [s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
2024-08-16 12:49:40.151 [error] [
'Failed to activate a workspace, Class name = m, completed in 401ms, has a falsy return value, Arg 1: Uri:/home/test_user/source/test_prod/test_project/env, Arg 2: {"started":1723808979277}, Return Value: undefined',
[s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
]
2024-08-16 12:49:40.151 [error] Failure during activation. [s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}
2024-08-16 12:49:40.151 [error] sendStartupTelemetry() failed. [s [Error]: Failed to resolve env "/home/test_user/anaconda3/envs/test_project"
at ae (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1968174)
at oe (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1966134)
at Immediate. (/home/test_user/.vscode/extensions/ms-python.python-2024.12.3-linux-x64/out/client/extension.js:2:1962428)
at process.processImmediate (node:internal/timers:478:21)] {
code: -4,
data: undefined
}

Extension version: 2024.12.3
VS Code version: Code 1.92.1 (eaa41d57266683296de7d118f574d0c2652e1fc4, 2024-08-07T20:16:39.455Z)
OS version: Linux x64 5.10.0-32-amd64
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (5 x 0)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 19.48GB (15.80GB free)
Process Argv . --crash-reporter-id 321d204-a10f-47e1-9cb9-0f3750d1a082
Screen Reader no
VM 100%
DESKTOP_SESSION gnome
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
g316j359:31013175
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
impr_priority:31102340
nativerepl1:31104043
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-t:31111718
nativeloc1:31118318
wkspc-ranged-t:31118572

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 16, 2024
@PrideChung
Copy link

Open VS Code "Settings", search for "Python Locator", switch from "native" to "js", this works for me.

@vinay-mylai
Copy link

I have the exact same issue (on Archlinux). In the settings, "Python Locator" is already set to "js" for me as the default.

@xyqjay
Copy link

xyqjay commented Aug 17, 2024

Open VS Code "Settings", search for "Python Locator", switch from "native" to "js", this works for me.

It helps! Thanks!

After experiencing many searches and restarts, this resolved my issue.

Here is the error, Hope this helps you. :
macOS: 14.6.1 M2 Apple Chip
conda 24.7.1
Python 3.11.5
VS Code Version: 1.92.2

2024-08-18 00:13:10.275 [info] Extension host with pid 1438 started
2024-08-18 00:13:10.275 [info] Skipping acquiring lock for /Users/user/Library/Application Support/Code/User/workspaceStorage/efaeb32ad8b421d2af966460dd3af93b.
2024-08-18 00:13:10.385 [info] ExtensionService#_doActivateExtension mechatroner.rainbow-csv, startup: false, activationEvent: 'onLanguage:plaintext'
2024-08-18 00:13:10.392 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2024-08-18 00:13:10.395 [info] ExtensionService#_doActivateExtension VisualStudioExptTeam.intellicode-api-usage-examples, startup: false, activationEvent: 'onLanguage:python'
2024-08-18 00:13:10.419 [info] ExtensionService#_doActivateExtension VisualStudioExptTeam.vscodeintellicode, startup: false, activationEvent: 'onLanguage:python'
2024-08-18 00:13:11.360 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2024-08-18 00:13:11.378 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2024-08-18 00:13:11.388 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2024-08-18 00:13:11.422 [info] Eager extensions activated
2024-08-18 00:13:11.426 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2024-08-18 00:13:11.427 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2024-08-18 00:13:11.430 [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
2024-08-18 00:13:11.448 [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: 'onStartupFinished'
2024-08-18 00:13:11.468 [info] ExtensionService#_doActivateExtension vadimcn.vscode-lldb, startup: false, activationEvent: 'onStartupFinished'
2024-08-18 00:13:11.535 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2024-08-18 00:13:28.029 [info] ExtensionService#_doActivateExtension ms-python.python, startup: false, activationEvent: 'onLanguage:python', root cause: ms-python.debugpy
2024-08-18 00:13:28.152 [info] ExtensionService#_doActivateExtension ms-python.debugpy, startup: false, activationEvent: 'onLanguage:python'
2024-08-18 00:13:28.160 [info] ExtensionService#_doActivateExtension ms-python.vscode-pylance, startup: false, activationEvent: 'onLanguage:python'
2024-08-18 00:13:30.051 [error] Error: Failed to resolve env "/Users/user/anaconda3"
	at ae (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1968174)
	at oe (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1966134)
	at Immediate.<anonymous> (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1962428)
	at process.processImmediate (node:internal/timers:478:21)
2024-08-18 00:13:32.360 [error] Error: Failed to resolve env "/Users/user/anaconda3"
	at ae (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1968174)
	at oe (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1966134)
	at Immediate.<anonymous> (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1962428)
	at process.processImmediate (node:internal/timers:478:21)
2024-08-18 00:13:34.949 [error] Error: Failed to resolve env "/Users/user/anaconda3"
	at ae (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1968174)
	at oe (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1966134)
	at Immediate.<anonymous> (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1962428)
	at process.processImmediate (node:internal/timers:478:21)
2024-08-18 00:14:01.138 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc'
2024-08-18 00:14:01.142 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2024-08-18 00:14:01.154 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2024-08-18 00:15:35.204 [error] Error: Failed to resolve env "/Users/user/anaconda3"
	at ae (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1968174)
	at oe (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1966134)
	at Immediate.<anonymous> (/Users/user/.vscode/extensions/ms-python.python-2024.12.3-darwin-arm64/out/client/extension.js:2:1962428)
	at process.processImmediate (node:internal/timers:478:21)

@corneliusroemer
Copy link

corneliusroemer commented Aug 17, 2024

This is potentially the same issue as #23963 and #23922

Switching Python Locator is just a workaround - there's still a bug somewhere.

@anthonykim1
Copy link

anthonykim1 commented Aug 19, 2024

Does

Open VS Code "Settings", search for "Python Locator", switch from "native" to "js", this works for me

work for you? @gurmitteotia

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Aug 19, 2024
@anthonykim1 anthonykim1 self-assigned this Aug 19, 2024
@gurmitteotia
Copy link
Author

gurmitteotia commented Aug 19, 2024

@anthonykim1 No, changing of "Python Locator" to "js" does not solve the issue for me. However downgrade of following 2 extension solve the issue for now. Looks like a bug in newer version.

pylance = v2024.7.1
python= v2024.8.1

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Aug 19, 2024
@vinay-mylai
Copy link

@gurmitteotia : Thanks. Downgrading fixes the issue for me too.

@anthonykim1
Copy link

@karthiknadig I think the error "Failed to resolve env...etc" is coming from

/vscode-python/python-env-tools/crates/pet/src/jsonrpc.rs

@agonzaleziniguez
Copy link

Switching from "native" to "js" in Python Locator solved the problem for me. However, in the Python Locator Output I still see the following:

2024-09-14 12:48:53.174 [info] Starting Python Locator c:\Users<USER>.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python-env-tools\bin\pet.exe server
2024-09-14 12:48:53.174 [error] thread '' panicked at crates\pet-windows-store\src\lib.rs:20:65:
byte index 1 is out of bounds of ``
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

2024-09-14 12:48:53.174 [error] thread '' panicked at crates\pet\src\find.rs:76:17:
a scoped thread panicked
thread '' panicked at crates\pet\src\find.rs:70:5:
a scoped thread panicked

2024-09-14 12:48:53.286 [warning] Failed to open HKLM\Software\Python, Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }
2024-09-14 12:48:53.288 [info] Discovered env: C:\Users<USER>\AppData\Local\Programs\Python\Python310\python.exe
2024-09-14 12:48:53.288 [info] Discovered env: C:\Users<USER>\AppData\Local\Programs\Python\Python311\python.exe
2024-09-14 12:48:53.289 [info] Discovered env: C:\Users<USER>\AppData\Local\Programs\Python\Python312\python.exe
2024-09-14 12:48:53.289 [info] Discovered env: C:\Users<USER>\AppData\Local\Programs\Python\Python38\python.exe
2024-09-14 12:48:53.290 [info] Discovered manager: (Conda) C:\Users<USER>\AppData\Local\miniforge3\Scripts\conda.exe
2024-09-14 12:48:53.290 [info] Discovered env: C:\Users<USER>\AppData\Local\miniforge3\envs\bilbao\python.exe
2024-09-14 12:48:53.290 [info] Discovered env: C:\Users<USER>\AppData\Local\miniforge3\envs\test_wengine\python.exe
2024-09-14 12:48:53.290 [info] Discovered env: C:\Users<USER>\AppData\Local\miniforge3\envs\test_wengine2\python.exe
2024-09-14 12:48:53.291 [info] Discovered env: C:\Users<USER>\AppData\Local\miniforge3\python.exe
2024-09-14 12:48:53.291 [info] Discovered env: C:\Users<USER>\AppData\Local\miniforge3\envs\py\python.exe


Windows 10
VS Code Version: 1.93.1
Python extension: 2024.14.1

@anthonykim1
Copy link

Apologies for late response.

I'm glad:

Switching from "native" to "js" in Python Locator solved the problem for me.

worked out for you. are you still seeing these panicked logs in your machine?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 21, 2024
@anthonykim1 anthonykim1 added area-environments Features relating to handling interpreter environments and removed info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team labels Nov 21, 2024
@vinay-mylai
Copy link

I don't see this issue in the latest version

@denisrosas
Copy link

I had Python and Pylance updated in my VSCode and I was still having this issue.
I found that it was getting the env path from the parameter "python.defaultInterpreterPath" in ~/.config/Code/User/settings.json file. I changed the value to "" and it worked.

@jmuchovej
Copy link

This was an issue for me when using devenv.nix. Resetting python.locator to js fixed it for me (particularly in Jupyter notebooks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-environments Features relating to handling interpreter environments
Projects
None yet
Development

No branches or pull requests

10 participants