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
VS Code: Auto env activation fails due to faulty usage of "conda activate" and "conda run" #412
pixi init, pixi add python=3.10 pytest a simplistic pixi project such as:
[project]
name = "simplistic_project"
version = "0.1.0"
description = "Add a short description here"
authors = ["zaubeerer"]
channels = ["conda-forge", "pytorch", "nvidia"]
platforms = ["linux-64"]
[tasks]
[dependencies]
python = "3.10.*"
pytest
Create a simplistic test_nothing.py:
deftest_pass():
pass
Manually select the pixi python executable as Python interpreter as described in #166 (comment), if it does not work automatically (see #411).
Refresh test discovery in the Testing Extension, which should fail with an error.
Issue description
As described in #411 and discussed on Discord Server, even after manual selection of the pixi python executable as Python interpreter, the tests are not discovered.
The reason for the malfunction is that VS Code attempts to activate the environment via conda activate ..., thus leading to an error as follows:
Error: Command failed: conda run -p {project_path}/.pixi/env
(...)
DirectoryNotACondaEnvironmentError: The target directory exists, but it is not a conda environment.
Expected behavior
VS Code should activate the pixi environment without using conda for:
Hello @Zaubeerer, unfortunately am I unable to recreate your issue. For me I only had to do the things @pavelzw points out in #166 Which you clearly found as well. The conda run part is new to me. So I have a few questions:
Would it be possible you have some kind of conda extension for vscode installed?
Do you have a conda base environment active?
Which version of vs-code do you use?
I hope we can figure it out!
changed the title [-]VS Code: Automatic environment activation fails due to faulty usage of "conda activate"[/-][+]VS Code: Auto env activation fails due to faulty usage of "conda activate" and "conda run"[/+]on Oct 29, 2023
Activity
Zaubeerer commentedon Oct 25, 2023
@pavelzw, did you already find a solution for this error?
Zaubeerer commentedon Oct 25, 2023
From a VS Code user perspective, I would say that fixing this issue is a must-have, while #411 and #166 are nice-to-have.
I will watch this issue and reconsider using pixi, when there is a workaround or solution for this.
ruben-arts commentedon Oct 26, 2023
Hello @Zaubeerer, unfortunately am I unable to recreate your issue. For me I only had to do the things @pavelzw points out in #166 Which you clearly found as well. The
conda runpart is new to me. So I have a few questions:I hope we can figure it out!
Zaubeerer commentedon Oct 26, 2023
That is great news!
Thanks for following up so quickly 🙏
Will check for those options again later today and let you know.
Zaubeerer commentedon Oct 27, 2023
I removed all
conda,mamba,micromambaandminicondaand now it works :)Hence, for now I am no longer blocked.
However, I suggest to keep this issue open, because conda and pixi should be installable in parallel in my opinion.
I will check, whether I can reinstall
conda,mamba, etc. without reintroducing the error.Zaubeerer commentedon Oct 29, 2023
Installation of micromamba seemed not to introduce the buggy behavior I experienced before.
I suggest to observe it for a while.
At this point, it would seem to me that compatibility with micromamba would be sufficient
Zaubeerer commentedon Oct 29, 2023
@ruben-arts, shall we somehow document this?
Happy to contribute a small PR if you think that makes sense :)
[-]VS Code: Automatic environment activation fails due to faulty usage of "conda activate"[/-][+]VS Code: Auto env activation fails due to faulty usage of "conda activate" and "conda run"[/+]ruben-arts commentedon Oct 29, 2023
We always love contributions, though I'm not sure what would be the proper place for this.
I changed the title of this issue so it's easier to search for. Do you think that would be enough for now?
Zaubeerer commentedon Oct 30, 2023
Yeah, I would probably have found it given the VS Code in the name. :)