Description
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 native
locator by default. When using the old js
locator 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:
- Install miniforge in homebrew via
brew install miniforge
. - Create a conda environment, e.g.
mamba create -n test_environ python=3.11
- Make sure that the native python locator is selected in the extension settings.
- Try to run a python file (or a jupyter notebook) interactively using the created environment.
Judging 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 Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
Python.log
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"}
Python Locator.log
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
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 version (& distribution if applicable, e.g. Anaconda): 3.12.4
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
- Value of the
python.languageServer
setting: Default
User Settings
languageServer: "Pylance"
Installed Extensions
Extension Name | Extension Id | Version |
---|---|---|
Black Formatter | ms-python.black-formatter | 2024.2.0 |
Code Spell Checker | streetsidesoftware.code-spell-checker | 3.0.1 |
CodeLLDB | vadimcn.vscode-lldb | 1.10.0 |
Docker | ms-azuretools.vscode-docker | 1.29.2 |
Entwicklungscontainer | ms-vscode-remote.remote-containers | 0.380.0 |
Even Better TOML | tamasfe.even-better-toml | 0.19.2 |
Excel to Markdown table | csholmq.excel-to-markdown-table | 1.3.0 |
German - Code Spell Checker | streetsidesoftware.code-spell-checker-german | 2.3.2 |
German Language Pack for Visual Studio Code | MS-CEINTL.vscode-language-pack-de | 1.92.2024081409 |
GitHub Codespaces | GitHub.codespaces | 1.17.2 |
GitHub Copilot | GitHub.copilot | 1.223.0 |
GitHub Copilot Chat | GitHub.copilot-chat | 0.18.2 |
GitLens — Git supercharged | eamodio.gitlens | 15.3.0 |
Go | golang.go | 0.42.0 |
Hexadezimal-Editor | ms-vscode.hexeditor | 1.10.0 |
isort | ms-python.isort | 2023.10.1 |
JavaScript Debugger | ms-vscode.js-debug | 1.92.0 |
JavaScript Debugger Companion Extension | ms-vscode.js-debug-companion | 1.1.3 |
Jupyter | ms-toolsai.jupyter | 2024.7.0 |
Jupyter Cell Tags | ms-toolsai.vscode-jupyter-cell-tags | 0.1.9 |
Jupyter Keymap | ms-toolsai.jupyter-keymap | 1.1.2 |
Jupyter Notebook Renderers | ms-toolsai.jupyter-renderers | 1.0.19 |
Jupyter Slide Show | ms-toolsai.vscode-jupyter-slideshow | 0.1.6 |
LaTeX Workshop | James-Yu.latex-workshop | 10.1.0 |
lean4 | leanprover.lean4 | 0.0.176 |
Markdown Preview Mermaid Support | bierner.markdown-mermaid | 1.23.1 |
Pylance | ms-python.vscode-pylance | 2024.8.1 |
Pylint | ms-python.pylint | 2023.10.1 |
Python | ms-python.python | 2024.12.3 |
Python Debugger | ms-python.debugpy | 2024.10.0 |
Remote - SSH | ms-vscode-remote.remote-ssh | 0.113.1 |
Remote - SSH: Editing Configuration Files | ms-vscode-remote.remote-ssh-edit | 0.86.0 |
Remote - Tunnels | ms-vscode.remote-server | 1.5.2 |
Remote-Explorer | ms-vscode.remote-explorer | 0.4.3 |
rust-analyzer | rust-lang.rust-analyzer | 0.3.2078 |
Table Visualizer for JavaScript Profiles | ms-vscode.vscode-js-profile-table | 1.0.9 |
Word Count | ms-vscode.wordcount | 0.1.0 |
System Info
Item | Value |
---|---|
CPUs | Apple M2 (8 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) | 16.00GB (0.19GB free) |
Process Argv | --crash-reporter-id d0b91948-e635-44b9-81c3-673cf98b8612 |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
f3je6385:31013174
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
impr_priority:31102340
refactort:31108082
pythonrstrctxt:31112756
flightc:31119335
wkspc-onlycs-c:31111717
wkspc-ranged-c:31118571