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 locator not finding pixi in stable and pre-release #24569

Closed
ChristianRothQC opened this issue Dec 10, 2024 · 9 comments
Closed

Python locator not finding pixi in stable and pre-release #24569

ChristianRothQC opened this issue Dec 10, 2024 · 9 comments
Assignees
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@ChristianRothQC
Copy link

Type: Bug

Behaviour

Pixi environments seem no longer detected by the locator code for me.

Steps to reproduce:

mkdir -p /tmp/foobar
cd /tmp/foobar
pixi init
pixi add python
pixi run ls
touch test.py
code .

If I try setting the interpreter path by hand, I get:

2024-12-10 11:34:05.730 [error] Python Extension: sendTelemetry l [Error]: Failed to resolve env ".pixi/envs/default/bin/python"
    at ae (/Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/out/client/extension.js:2:2037533)
    at oe (/Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/out/client/extension.js:2:2035493)
    at Immediate.<anonymous> (/Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/out/client/extension.js:2:2031787)
    at processImmediate (node:internal/timers:483:21) {
  code: -4,
  data: undefined
}
2024-12-10 11:34:05.734 [info] Discover tests for workspace name: foobar - uri: /private/tmp/foobar
2024-12-10 11:34:05.734 [info] Python interpreter path: ./.pixi/envs/default/bin/python
2024-12-10 11:34:05.736 [info] > conda info --json
2024-12-10 11:34:05.736 [info] shell: zsh
2024-12-10 11:34:06.039 [info] > conda run -n default --no-capture-output python ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py
2024-12-10 11:34:06.039 [info] shell: zsh
2024-12-10 11:34:06.220 [error] getActivatedEnvironmentVariables Error: Command failed: conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /Users/christianroth/miniforge3/envs/default


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:339:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py'
}
2024-12-10 11:34:06.221 [info] > conda info --json
2024-12-10 11:34:06.221 [info] shell: bash
2024-12-10 11:34:06.516 [info] > conda run -n default --no-capture-output python ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py
2024-12-10 11:34:06.516 [info] shell: bash
2024-12-10 11:34:06.678 [error] getActivatedEnvironmentVariables Error: Command failed: conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /Users/christianroth/miniforge3/envs/default


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py'
}
2024-12-10 11:34:32.944 [info] Native locator: Refresh started
2024-12-10 11:34:32.953 [info] Conda environment manager found at: /Users/christianroth/miniforge3/bin/conda
2024-12-10 11:34:32.977 [info] Native locator: Refresh finished in 32 ms
2024-12-10 11:34:32.978 [info] Discover tests for workspace name: foobar - uri: /private/tmp/foobar
2024-12-10 11:34:32.979 [info] > conda run -n default --no-capture-output python ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py
2024-12-10 11:34:32.979 [info] shell: zsh
2024-12-10 11:34:33.167 [error] getActivatedEnvironmentVariables Error: Command failed: conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /Users/christianroth/miniforge3/envs/default


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py'
}
2024-12-10 11:34:33.168 [info] > conda run -n default --no-capture-output python ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py
2024-12-10 11:34:33.168 [info] shell: bash
2024-12-10 11:34:33.331 [error] getActivatedEnvironmentVariables Error: Command failed: conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /Users/christianroth/miniforge3/envs/default


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'conda run -n default --no-capture-output python /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/get_output_via_markers.py /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python_files/printEnvVariables.py'
}
2024-12-10 11:34:36.382 [error] Python Extension: sendTelemetry l [Error]: Failed to resolve env ".pixi/envs/default/bin/python"
    at ae (/Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/out/client/extension.js:2:2037533)
    at oe (/Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/out/client/extension.js:2:2035493)
    at Immediate.<anonymous> (/Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/out/client/extension.js:2:2031787)
    at processImmediate (node:internal/timers:483:21) {
  code: -4,
  data: undefined
}

Diagnostic data

Output for Python Locator in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2024-12-10 11:30:49.341 [info] Starting Python Locator /Users/christianroth/.vscode/extensions/ms-python.python-2024.21.2024120501-darwin-arm64/python-env-tools/bin/pet server
2024-12-10 11:30:49.342 [info] Discovered manager: (Conda) /Users/christianroth/miniforge3/bin/conda
2024-12-10 11:30:49.342 [info] Discovered env: /Users/christianroth/miniforge3/bin/python
2024-12-10 11:30:49.346 [info] Discovered env: /usr/bin/python3
2024-12-10 11:30:49.347 [info] Locator Conda took 124.80075ms
2024-12-10 11:30:49.347 [info] Locator Homebrew took 118.060875ms
2024-12-10 11:30:49.347 [info] Locator MacCommandLineTools took 121.4985ms
2024-12-10 11:30:49.347 [info] Locator MacPythonOrg took 117.260291ms
2024-12-10 11:30:49.347 [info] Locator MacXCode took 118.284041ms
2024-12-10 11:30:49.347 [info] Locator PipEnv took 117.773791ms
2024-12-10 11:30:49.347 [info] Locator Poetry took 118.887083ms
2024-12-10 11:30:49.347 [info] Locator PyEnv took 327.584µs
2024-12-10 11:30:49.347 [info] Locator Venv took 1.009625ms
2024-12-10 11:30:49.347 [info] Locator VirtualEnv took 1.016709ms
2024-12-10 11:30:49.347 [info] Locator VirtualEnvWrapper took 1.081167ms
2024-12-10 11:30:49.347 [info] Locator GlobalVirtualEnvs took 1.109ms
2024-12-10 11:30:49.347 [info] Locator Locators took 124.895125ms
2024-12-10 11:30:49.347 [info] Locator Path took 126.013708ms
2024-12-10 11:30:49.347 [info] Locator Workspaces took 118.567834ms
2024-12-10 11:30:49.347 [info] Refresh completed in 126ms
2024-12-10 11:30:49.348 [info] Resolved Python Environment /Users/christianroth/miniforge3/bin/python
2024-12-10 11:30:49.554 [info] Resolved Python Environment /usr/bin/python3

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2024-12-10 11:30:49.341 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-12-10 11:30:49.341 [info] Experiment 'pythonSurveyNotification' is active
2024-12-10 11:30:49.341 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-12-10 11:30:49.341 [info] Experiment 'pythonTestAdapter' is active
2024-12-10 11:30:49.341 [info] Native locator: Refresh started
2024-12-10 11:30:49.342 [info] Conda environment manager found at: /Users/christianroth/miniforge3/bin/conda
2024-12-10 11:30:49.347 [info] Native locator: Refresh finished in 192 ms
2024-12-10 11:30:49.350 [info] > ~/miniforge3/bin/conda config --get auto_activate_base
2024-12-10 11:30:49.549 [info] > pyenv which python
2024-12-10 11:30:49.549 [info] cwd: .
2024-12-10 11:30:49.554 [info] Python interpreter path: /usr/bin/python3
2024-12-10 11:30:49.575 [info] > ~/miniforge3/bin/conda info --json
2024-12-10 11:30:59.628 [info] Starting Pylance language server.

Extension version: 2024.21.2024120501
VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Darwin arm64 24.1.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.6
  • 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
Azure Account ms-vscode.azure-account 0.12.0
Azure Pipelines ms-azure-devops.azure-pipelines 1.247.2
Azure Resources ms-azuretools.vscode-azureresourcegroups 0.9.9
Docker ms-azuretools.vscode-docker 1.29.3
Even Better TOML tamasfe.even-better-toml 0.19.2
GitHub Copilot GitHub.copilot 1.249.0
GitHub Copilot Chat GitHub.copilot-chat 0.22.4
GitLens — Git supercharged eamodio.gitlens 16.0.5
JavaScript Debugger ms-vscode.js-debug 1.95.3
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter ms-toolsai.jupyter 2024.10.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.21
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Mypy Type Checker ms-python.mypy-type-checker 2024.0.0
Pylance ms-python.vscode-pylance 2024.12.1
Python ms-python.python 2024.21.2024120501
Python Debugger ms-python.debugpy 2024.12.0
Ruff charliermarsh.ruff 2024.56.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
System Info
Item Value
CPUs Apple M3 Max (16 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) 64.00GB (7.39GB free)
Process Argv --crash-reporter-id 42cef842-40f4-4638-b715-416262941203
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551:31179978
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31192215
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530

cc @ruben-arts, @pavelzw

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 10, 2024
@karthiknadig
Copy link
Member

karthiknadig commented Dec 10, 2024

@ChristianRothQC Try 2024.23 pre-release. 2024.23 pre-release has the fix for pixi.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 10, 2024
@karthiknadig karthiknadig self-assigned this Dec 10, 2024
@ChristianRothQC
Copy link
Author

wow, thanks for the quick response :) Just a quick check 2024.23 pre-release is not on marketplace yet, right? Is there another way to get a pre-built version or am I just too impatient? 😬

Image

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Dec 10, 2024
@karthiknadig
Copy link
Member

It took longer than expected to publish:
Image

Bit more detail on the pixi support. There are two variants, legacy JavaScript support and newer Native Locator support (controlled using the setting python.locator). The js support is on its way out, and native is being experimented right now with intent of getting to stable soon. You may have been in the native experiment if pixi stopped working for you. Please let me know how the fix goes.

@ChristianRothQC
Copy link
Author

You may have been in the native experiment if pixi stopped working for you.

Hehe lucky me 😬

2024-12-10 17:21:41.065 [warning] Unable to find conda package Python in "/private/tmp/foobar/.pixi/envs/default", trying slower approach
2024-12-10 17:21:41.066 [info] Discovered env: /private/tmp/foobar/.pixi/envs/default/bin/python
2024-12-10 17:21:41.066 [info] Discovered manager: (Conda) /Users/christianroth/miniforge3/bin/conda
2024-12-10 17:21:41.066 [info] Discovered env: /Users/christianroth/miniforge3/bin/python
2024-12-10 17:21:41.068 [info] Discovered env: /usr/bin/python3
2024-12-10 17:21:41.086 [info] Locator Conda took 7.417458ms
2024-12-10 17:21:41.086 [info] Locator Homebrew took 22.599334ms
2024-12-10 17:21:41.086 [info] Locator MacCommandLineTools took 5.169667ms
2024-12-10 17:21:41.086 [info] Locator MacPythonOrg took 233.625µs
2024-12-10 17:21:41.086 [info] Locator MacXCode took 242µs
2024-12-10 17:21:41.086 [info] Locator PipEnv took 22.292µs
2024-12-10 17:21:41.086 [info] Locator Pixi took 362.666µs
2024-12-10 17:21:41.086 [info] Locator Poetry took 497.209µs
2024-12-10 17:21:41.086 [info] Locator PyEnv took 167.708µs
2024-12-10 17:21:41.086 [info] Locator Venv took 142.167µs
2024-12-10 17:21:41.086 [info] Locator VirtualEnv took 86.834µs
2024-12-10 17:21:41.086 [info] Locator VirtualEnvWrapper took 15.25µs
2024-12-10 17:21:41.087 [info] Locator GlobalVirtualEnvs took 167.209µs
2024-12-10 17:21:41.087 [info] Locator Locators took 22.870958ms
2024-12-10 17:21:41.087 [info] Locator Path took 13.634041ms
2024-12-10 17:21:41.087 [info] Locator Workspaces took 2.114625ms
2024-12-10 17:21:41.087 [info] Refresh completed in 22ms

2024.23 pre-release indeed brings back pixi - thanks so much for the quick fix!

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 10, 2024
@karthiknadig
Copy link
Member

Thanks for the confirmation, if you run into to issue please let us know.

@maurosilber
Copy link

I'm also having issues with the native locator for pixi environments in the latest release. Changing to the js locator works fine.

Versions:

  • VSCode: 1.96.0
  • ms-python.python: 2024.22.0
  • OS: Darwin arm64 24.1.0

Output -> Python Locator:

2024-12-12 12:30:21.435 [info] Starting Python Locator <home-dir>/.vscode/extensions/ms-python.python-2024.22.0-darwin-arm64/python-env-tools/bin/pet server
2024-12-12 12:30:22.089 [warning] Unable to find conda package Python in "<project-dir>/.pixi/envs/default", trying slower approach
2024-12-12 12:30:22.089 [error] Unable to find Conda Manager for env: CondaEnvironment { prefix: "<project-dir>/.pixi/envs/default", executable: Some("<project-dir>/.pixi/envs/default/bin/python"), version: Some("3.10.12"), conda_dir: None, arch: None }
2024-12-12 12:30:22.090 [info] Discovered env: /usr/bin/python3
2024-12-12 12:30:22.102 [info] Resolved Python Environment <project-dir>/.pixi/envs/default/bin/python
2024-12-12 12:30:22.138 [info] Locator Conda took 13.918208ms
2024-12-12 12:30:22.138 [info] Locator Homebrew took 74.069584ms
...
2024-12-12 12:30:22.141 [info] Refresh completed in 142ms

@karthiknadig
Copy link
Member

Please try the pre-release 2024.23.* that is the build that has the fix.

@lgonzalezsa
Copy link

lgonzalezsa commented Dec 12, 2024

Having same issue and using the pre-release 2024.23.2024121003 gives me back the ability to locate Python.

My repo has a local Python package, which I can access using ipython but when using jupyter notebooks, fails saying ModuleNotFoundError.
If I start a jupyter notebook server and instruct the notebook to use an existing Jupyter Server, works fine.
Previously was not having that issue, any help?

@karthiknadig
Copy link
Member

@lgonzalezsa With 2024.23 is Jupyter not able to handle pixi? If so can you file a bug on the Jupyter extension?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

4 participants