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

Using python and test plugin fails to recognise pixi environment #23975

Closed
sailngarbwm opened this issue Aug 20, 2024 · 10 comments
Closed

Using python and test plugin fails to recognise pixi environment #23975

sailngarbwm opened this issue Aug 20, 2024 · 10 comments
Assignees
Labels
area-testing triage-needed Needs assignment to the proper sub-team

Comments

@sailngarbwm
Copy link

Hi vscode-python folks,

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:

image

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:

image

Python plugin version:
v2024.12.3

Any help would be great, as I can't wait to use all of these new tools together!

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 20, 2024
@eleanorjboyd eleanorjboyd self-assigned this Aug 20, 2024
@PanTheDev
Copy link

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
Copy link
Author

hi, @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?

@sailngarbwm
Copy link
Author

@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:
image

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
Copy link
Author

if I enter the full path here as an interpreter environment:
image

It will show up as the relative path:

image

and cause the no interpreter drama:
image

@eleanorjboyd
Copy link
Member

Great note! Would be important to fix - thanks!

@eleanorjboyd
Copy link
Member

@karthiknadig what are your thoughts on this issue here regarding relative vs absolute paths and how they are displayed with the environments?

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

This should be looked at by pixi owners. /cc @baszalmstra @wolfv

@anthonykim1 in case you have some context on this.

@anthonykim1
Copy link

I think the assumption is we pretty much expect and calculate only starting from projectDir/workspaceDir from

// Usually the pixi environments are stored under `<projectDir>/.pixi/envs/<environment>/`. So,

Wondering if making this prefix more generic to cover absolute path will resolve this issue.

@baszalmstra
Copy link

Yeah it makes sense that that would help!

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Aug 28, 2024
@anthonykim1
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

6 participants