You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using python and test plugin fails to recognise pixi environment #23975
I have been using the Python plugin with pytest and the test plugin for a long time with conda/mamba environments, but I have recently switched to Pixi for python environment management. Using the Python plugin, I have pointed the interpreter to my pixi environment path, and have been able to run notebooks and the like using the interpreter.
However, the test plugin does not recognise the pixi environment as a pixi environment, showing the following output error when searching for the tests:
It appears like it can't find pixi, so is trying to run it as a mamba environment.
I am running vscode using the "remote" plugin on WSL 2 Debian
vscode version:
Python plugin version:
v2024.12.3
Any help would be great, as I can't wait to use all of these new tools together!
Is the .pixi directory at the root of your active workspace? I'm using a multi-root workspace and Vscode can't find Pix envs properly if there isn't a .pixi at the root of each project. In my case, I am using symlinks to the single .pixi I have.
hi, Raphaël Melançon (@PanTheDev). Thank you very much for the advice, the pixi directory is in the project root (in this case ~/repos/vision-suite-2024/forecasting/. However, the pixi utility is installed in another location ~/.pixi/bin/pixi does that need to be in the active directory of the vscode project as well?
Raphaël Melançon (@PanTheDev) Your advice set me on the right track actually, apparently I was typing in the full path when setting the python interpreter in the "enter interpreter path.." field:
however, if I use the relative path to the workspace root, the test extension works!
One thing that could be a bug or improvement to the vs code-python package is that the listed interpreter file path shows up as the relative path, even if you have typed in the full path. Therefore, I needed to find out that I had typed it incorrectly.
Karthik Nadig (@karthiknadig) what are your thoughts on this issue here regarding relative vs absolute paths and how they are displayed with the environments?
I filed: #24042
I'm wondering if entering the absolute path for interpreter is the cause, instead of being pixi specific. Would have to spend some time on this.
Activity
PanTheDev commentedon Aug 22, 2024
Is the .pixi directory at the root of your active workspace? I'm using a multi-root workspace and Vscode can't find Pix envs properly if there isn't a .pixi at the root of each project. In my case, I am using symlinks to the single .pixi I have.
sailngarbwm commentedon Aug 23, 2024
hi, Raphaël Melançon (@PanTheDev). Thank you very much for the advice, the pixi directory is in the project root (in this case
~/repos/vision-suite-2024/forecasting/. However, the pixi utility is installed in another location~/.pixi/bin/pixidoes that need to be in the active directory of the vscode project as well?sailngarbwm commentedon Aug 23, 2024
Raphaël Melançon (@PanTheDev) Your advice set me on the right track actually, apparently I was typing in the full path when setting the python interpreter in the "enter interpreter path.." field:

however, if I use the relative path to the workspace root, the test extension works!
One thing that could be a bug or improvement to the vs code-python package is that the listed interpreter file path shows up as the relative path, even if you have typed in the full path. Therefore, I needed to find out that I had typed it incorrectly.
sailngarbwm commentedon Aug 23, 2024
if I enter the full path here as an interpreter environment:

It will show up as the relative path:
and cause the no interpreter drama:

eleanorjboyd commentedon Aug 28, 2024
Great note! Would be important to fix - thanks!
eleanorjboyd commentedon Aug 28, 2024
Karthik Nadig (@karthiknadig) what are your thoughts on this issue here regarding relative vs absolute paths and how they are displayed with the environments?
karthiknadig commentedon Aug 28, 2024
This should be looked at by
pixiowners. /cc Bas Zalmstra (@baszalmstra) Wolf Vollprecht (@wolfv)Anthony Kim (@anthonykim1) in case you have some context on this.
anthonykim1 commentedon Aug 28, 2024
I think the assumption is we pretty much expect and calculate only starting from projectDir/workspaceDir from
vscode-python/src/client/pythonEnvironments/common/environmentManagers/pixi.ts
Line 294 in 7ccf01e
Wondering if making this prefix more generic to cover absolute path will resolve this issue.
baszalmstra commentedon Aug 28, 2024
Yeah it makes sense that that would help!
anthonykim1 commentedon Sep 3, 2024
I filed: #24042
I'm wondering if entering the absolute path for interpreter is the cause, instead of being pixi specific. Would have to spend some time on this.
Lets track it: #24042