Skip to content

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

Closed as not planned

Description

@sailngarbwm

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!

Activity

  1. PanTheDev commented on Aug 22, 2024

    @PanTheDev

    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.

  2. sailngarbwm commented on Aug 23, 2024

    @sailngarbwm
    Author

    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?

  3. sailngarbwm commented on Aug 23, 2024

    @sailngarbwm
    Author

    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:
    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.

  4. sailngarbwm commented on Aug 23, 2024

    @sailngarbwm
    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

  5. eleanorjboyd commented on Aug 28, 2024

    @eleanorjboyd

    Great note! Would be important to fix - thanks!

  6. eleanorjboyd commented on Aug 28, 2024

    @eleanorjboyd

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

  7. karthiknadig commented on Aug 28, 2024

    @karthiknadig
    Member

    This should be looked at by pixi owners. /cc Bas Zalmstra (@baszalmstra) Wolf Vollprecht (@wolfv)

    Anthony Kim (@anthonykim1) in case you have some context on this.

  8. anthonykim1 commented on Aug 28, 2024

    @anthonykim1

    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.

  9. baszalmstra commented on Aug 28, 2024

    @baszalmstra

    Yeah it makes sense that that would help!

  10. anthonykim1 commented on Sep 3, 2024

    @anthonykim1

    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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions