microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.29k stars 1.17k forks source link

Stuck on "Reactivating terminals" - Failed to resolve env #23922

Open DrShushen opened 1 month ago

DrShushen commented 1 month ago

Type: Bug

Since the latest update of VSCode Insiders, the Python extension fails to launch (no syntax highlighting etc.), there is a permanent "Reactivating terminals..." in the status bar, and when I select OUTPUT > Python, I see the following error:

2024-08-07 18:35:35.873 [error] sendStartupTelemetry() failed. s [Error]: Failed to resolve env "/mnt/data-linux/miniconda3"
    at ae (/home/user/.vscode-insiders/extensions/ms-python.python-2024.12.2-linux-x64/out/client/extension.js:2:1968174)
    at oe (/home/user/.vscode-insiders/extensions/ms-python.python-2024.12.2-linux-x64/out/client/extension.js:2:1966134)
    at Immediate.<anonymous> (/home/user/.vscode-insiders/extensions/ms-python.python-2024.12.2-linux-x64/out/client/extension.js:2:1962428)
    at processImmediate (node:internal/timers:478:21) {
  code: -4,
  data: undefined
}

Not sure if it is related to the fact that my conda environments are on a mounted partition under /mnt/.

I have tried with Python pre-release and Release versions of the extension, and the issue happens in both cases.

The issue does not happen in vanilla VSCode (non Insiders)


VSCode info

Version: 1.93.0-insider
Commit: d4c4e690b9f1e70291da9a46c5c8ac5ebfbda81a
Date: 2024-08-07T05:03:47.999Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.8.0-39-generic snap

System info:

## Report details
- **Date generated:**                              2024-08-07 18:41:37

## Hardware Information:
- **Hardware Model:**                              ASUS ROG STRIX B460-H GAMING
- **Memory:**                                      64.0 GiB
- **Processor:**                                   Intel® Core™ i9-10900K × 20
- **Graphics:**                                    NVIDIA GeForce RTX™ 3090
- **Disk Capacity:**                               7.0 TB

## Software Information:
- **Firmware Version:**                            1610
- **OS Name:**                                     Ubuntu 24.04 LTS
- **OS Build:**                                    (null)
- **OS Type:**                                     64-bit
- **GNOME Version:**                               46
- **Windowing System:**                            X11
- **Kernel Version:**                              Linux 6.8.0-39-generic

Tried with Python extension:

Extension version: 2024.12.2 VS Code version: Code - Insiders 1.93.0-insider (d4c4e690b9f1e70291da9a46c5c8ac5ebfbda81a, 2024-08-07T05:03:47.999Z) OS version: Linux x64 6.8.0-39-generic snap Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz (20 x 4899)| |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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off| |Load (avg)|0, 0, 0| |Memory (System)|62.70GB (50.98GB free)| |Process Argv|--no-sandbox --force-user-env --crash-reporter-id 5e036db4-7975-4920-936d-345ce33b1cab| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 vsaa593:30376534 py29gd2263:31024238 c4g48928:30535728 962ge761:30841072 pythongtdpath:30726887 welcomedialog:30812478 pythonnoceb:30776497 asynctok:30898717 dsvsc013:30777762 dsvsc014:30777825 dsvsc015:30821418 pythonregdiag2:30926734 pythonmypyd1:30859725 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30870582 dsvsc016:30879898 dsvsc017:30880771 dsvsc018:30880772 cppperfnew:30980852 pythonait:30973460 g316j359:31013175 a69g1124:31018687 dvdeprecation:31040973 dwnewjupytercf:31046870 2f103344:31071589 legacy_priority:31057981 nativerepl1:31104042 refactort:31084545 pythonrstrctxt:31093868 flightc:31105041 wkspc-onlycs-c:31111717 nativeloc1:31111755 wkspc-ranged-c:31111712 cf971741:31111988 fcdif617:31111928 ```
DrShushen commented 1 month ago

More info for debugging this.

I have installed the exact same version of VSCode Insiders but with apt rather than snap, and this issue no longer happens.

See below the version info (the only difference is OS: Linux x64 6.8.0-39-generic vs OS: Linux x64 6.8.0-39-generic snap.

Version: 1.93.0-insider
Commit: d4c4e690b9f1e70291da9a46c5c8ac5ebfbda81a
Date: 2024-08-07T05:03:47.999Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.8.0-39-generic

Python extension version: v2024.13.2024080701 (pre-release)

zhao-kun commented 1 month ago

Same problems. Except for the difference in the OS version, my VsCode insider version is the same. Version details:


Commit: d4c4e690b9f1e70291da9a46c5c8ac5ebfbda81a
Date: 2024-08-07T05:03:47.999Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Linux x64 5.10.222-1-MANJARO```
SanBingYouYong commented 3 weeks ago

Just encountered this on my win11 laptop locally, but when connected via ssh to remote linux server everything is fine.. both environments are set up with miniconda3

2024-08-16 17:02:53.403 [error] Failure during activation. s [Error]: Failed to resolve env "C:\\Users\\13152\\miniconda3"
    at ae (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1968174)
    at oe (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1966134)
    at Immediate.<anonymous> (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1962428)
    at processImmediate (node:internal/timers:478:21) {
  code: -4,
  data: undefined
}
2024-08-16 17:02:53.403 [error] sendStartupTelemetry() failed. s [Error]: Failed to resolve env "C:\\Users\\13152\\miniconda3"
    at ae (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1968174)
    at oe (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1966134)
    at Immediate.<anonymous> (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1962428)
    at processImmediate (node:internal/timers:478:21) {
  code: -4,
  data: undefined
}

And this is not an Insider version:

Version: 1.92.2 (user setup)
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Update: After leaving it to run for a solid period of time (when I come back) the problem is mysteriously gone. I have no clue what is going on in the whatever backend this might involve but I do feel bad to somehow lose control of my workspace.

karthiknadig commented 3 weeks ago

A few things to try: [Option 1] Try the command Python: Clear Cache and re-load from the command 🎨. I suspect there might be paths in cache that it is trying to find and somehow failing. [Option 2] Try setting python.locator to native and reload. This will use a newer detector for python that should work faster. But, be sure to be on latest stable (2024.12.3 or greater) to get this.

corneliusroemer commented 3 weeks ago

Possibly same issue as this: #23963 (I encountered on macOS ARM)

Restarting my computer helped for me. My locator is already set to "native".

@karthiknadig did you maybe mean switch from native to js? The problem could be with native rather than js. At least per #23956 this helped some.

SanBingYouYong commented 3 weeks ago

Just encountered this on my win11 laptop locally, but when connected via ssh to remote linux server everything is fine.. both environments are set up with miniconda3

2024-08-16 17:02:53.403 [error] Failure during activation. s [Error]: Failed to resolve env "C:\\Users\\13152\\miniconda3"
    at ae (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1968174)
    at oe (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1966134)
    at Immediate.<anonymous> (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1962428)
    at processImmediate (node:internal/timers:478:21) {
  code: -4,
  data: undefined
}
2024-08-16 17:02:53.403 [error] sendStartupTelemetry() failed. s [Error]: Failed to resolve env "C:\\Users\\13152\\miniconda3"
    at ae (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1968174)
    at oe (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1966134)
    at Immediate.<anonymous> (c:\Users\13152\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:1962428)
    at processImmediate (node:internal/timers:478:21) {
  code: -4,
  data: undefined
}

And this is not an Insider version:

Version: 1.92.2 (user setup)
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Update: After leaving it to run for a solid period of time (when I come back) the problem is mysteriously gone. I have no clue what is going on in the whatever backend this might involve but I do feel bad to somehow lose control of my workspace.

This issue occurs again and this time I tried the solution @corneliusroemer mentioned (switching native/js) and switching locator from native to js solved this issue for me after restarting vscode.

austinmw commented 3 weeks ago

I got the same error. Fresh install of VSCode (not insiders) on silicon mac. The above solution fixed it:

"python.locator": "js"

Not sure why this is broken, but not happy I wasted over an hour on this..

corneliusroemer commented 3 weeks ago

Thanks for sharing this worked for you @austinmw. I made a Stackoverflow question and answer in the hope more people quickly find the workaround until there's a proper fix: https://stackoverflow.com/questions/78886125/vscode-python-extension-stuck-on-reactivating-terminals/78886126#78886126

Update: wow the Q&A has already 135 views in just 11 hours - this suggests that a lot of people are getting this error. @karthiknadig would be great if someone at MSFT could look at this, I think. Hope the ping is ok in this case.

karthiknadig commented 3 weeks ago

There should be a mitigation pushed out in pre-release.

related: https://github.com/microsoft/vscode-python/issues/23982

anthonykim1 commented 1 week ago

Are folks still suffering from this on the latest pre-release version? Just got another issue from https://github.com/microsoft/vscode-python/issues/24026 so I want to make sure. Thought this was resolved based on:https://github.com/microsoft/vscode-python/issues/23982#issuecomment-2311733151

corneliusroemer commented 1 week ago

@anthonykim1 I think it's impossible to say - report #24026 you linked to is insufficient to allow any conclusions - it's missing version of extension that's being used.

anthonykim1 commented 4 days ago

@corneliusroemer Great point - Are folks using 2024.14.0 https://github.com/microsoft/vscode-python/releases/tag/v2024.14.0 or the latest pre-release of Python extension experiencing this 'reactivating terminals' problem?

nurpax commented 1 day ago

FWIW I just hit this with an updated VSCode (not insiders version):

Version: 1.93.0 (system setup)
Commit: 4849ca9bdf9666755eb463db297b69e5385090e3
Date: 2024-09-04T13:02:38.431Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

Found the fix through the SO post, changing the "python.locator" to "js" helped.

corneliusroemer commented 1 day ago

@nurpax thanks for the report! What's your Python extension version?

nurpax commented 1 day ago

Looks like Python is at v2024.14.0. Pylance is v2024.9.1 in case that's relevant here.

corneliusroemer commented 1 day ago

@anthonykim1 something seems to have happened recently making this bug more frequent for folks - the views on my Stackoverflow question have shot up like crazy in the last day, I think from 600 to 900, and the question has been open for 23 days. So the view rate might be the highest it has ever been.

Adding a screenshot so we have a trackrecord:

-   0 views on 2024-08-19Z00:31:00 (UTC)
- 558 views on 2024-09-05Z23:04:58 (UTC) [ 32.9 views/day since previous snapshot]
- 947 views on 2024-09-11Z15:54:21 (UTC) [ 64.7 views/day since previous snapshot]
- 986 views on 2024-09-11Z19:28:00 (UTC) [262.4 views/day since previous snapshot]

See: https://web.archive.org/web/20240000000000*/https://stackoverflow.com/questions/78886125/vscode-python-extension-loading-forever-saying-reactivating-terminals