2024-08-19 12:42:09.715 [info] Conda environment manager found at: /opt/homebrew/Caskroom/miniforge/base/bin/conda
2024-08-19 12:42:09.743 [info] Native locator: Refresh finished in 68 ms
2024-08-19 12:42:12.431 [error] Invalid version for /opt/homebrew/Caskroom/miniforge/base/envs/test_environ/bin/python: {"name":"","location":"/opt/homebrew/bin/python","kind":"global-system","id":"/opt/homebrew/bin/python","executable":{"filename":"/opt/homebrew/bin/python","sysPrefix":"","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python"}
2024-08-19 12:42:12.450 [error] Invalid version for /opt/homebrew/bin/python: {"name":"","location":"/opt/homebrew/bin/python","kind":"global-system","id":"/opt/homebrew/bin/python","executable":{"filename":"/opt/homebrew/bin/python","sysPrefix":"","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python"}
2024-08-19 12:42:12.450 [error] Invalid version for /opt/homebrew/bin/python: {"name":"","location":"/opt/homebrew/bin/python","kind":"global-system","id":"/opt/homebrew/bin/python","executable":{"filename":"/opt/homebrew/bin/python","sysPrefix":"","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python"}
2024-08-19 12:42:12.450 [error] Invalid version for /opt/homebrew/bin/python: {"name":"","location":"/opt/homebrew/bin/python","kind":"global-system","id":"/opt/homebrew/bin/python","executable":{"filename":"/opt/homebrew/bin/python","sysPrefix":"","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python"}
2024-08-19 12:42:12.429 [error] Failed to execute Python to resolve info "/opt/homebrew/bin/python": No such file or directory (os error 2)
2024-08-19 12:42:12.429 [error] Failed to resolve env "/opt/homebrew/Caskroom/miniforge/base/envs/test_environ/bin/python", returning discovered env PythonEnvironment { display_name: None, name: None, executable: Some("/opt/homebrew/bin/python"), kind: Some(Homebrew), version: None, prefix: None, manager: None, project: None, arch: None, symlinks: Some(["/opt/homebrew/Caskroom/miniforge/base/envs/test_environ/bin/python3.11", "/opt/homebrew/bin/python"]) }
2024-08-19 12:42:12.429 [info] Resolved Python Environment /opt/homebrew/bin/python
2024-08-19 12:42:12.450 [error] Failed to execute Python to resolve info "/opt/homebrew/bin/python": No such file or directory (os error 2)
2024-08-19 12:42:12.450 [error] Failed to resolve env "/opt/homebrew/bin/python", returning discovered env PythonEnvironment { display_name: None, name: None, executable: Some("/opt/homebrew/bin/python"), kind: Some(Homebrew), version: None, prefix: None, manager: None, project: None, arch: None, symlinks: Some(["/opt/homebrew/bin/python"]) }
2024-08-19 12:42:12.450 [info] Resolved Python Environment /opt/homebrew/bin/python
Type: Bug
Behaviour
The native python locator does not correctly resolve my conda environments from a miniforge installation on MacOS, where miniforge itself was installed via homebrew. The issue occurs on two separate computers, I only discovered the problem because on the newer installation the python extension was set to use the new
nativelocator by default. When using the oldjslocator everything works as expected.After trying to select my environment in an interactive python window, the displayed python version in the GUI becomes "Python -1.-1.-1" and an error is reported that the kernel could not be started because the python environment is not available any more.
Steps to reproduce:
brew install miniforge.mamba create -n test_environ python=3.11Judging from the log files, it seems that after these steps, the new locator tries to run
/opt/homebrew/bin/python(which does not even exist!), rather than the correct/opt/homebrew/Caskroom/miniforge/base/envs/test_environ/bin/python3.11.Diagnostic data
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Python.log
Python Locator.log
Extension version: 2024.12.3
VS Code version: Code 1.92.2 (Universal) (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Darwin arm64 23.6.0
Modes:
python.languageServersetting: DefaultUser 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