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

Why are not all environments created on pixi install? #1333

Closed
2 tasks done
vigneshmanick opened this issue May 6, 2024 · 4 comments
Closed
2 tasks done

Why are not all environments created on pixi install? #1333

vigneshmanick opened this issue May 6, 2024 · 4 comments
Labels
🐞 bug Something isn't working ❓ question Further information is requested

Comments

@vigneshmanick
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "dummyproj"
version = "0.1"
requires-python = "==3.11.*"

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "win-64"]

[tool.pixi.system-requirements]
linux = "3.10.0"

[tool.pixi.dependencies]
pip = ">=24.0,<25"
requests = ">=2.31.0,<2.32"
numpy = ">=1.26.4,<1.27"
pandas = ">=2.2.2,<2.3"
matplotlib = ">=3.8.4,<3.9"
pydantic = ">=2.7.0,<2.8"

[tool.pixi.feature.lint.dependencies]
ruff = ">=0.3.4,<0.4"

[tool.pixi.feature.lint.tasks]
lint = "ruff check ."

[tool.pixi.tasks]
plot = "python -m dummyproj.plot"
task1 = "echo hi from pyproject"

[tool.pixi.environments]
lint = {features = ["lint"], no-default-feature = true}

Issue description

In the above example, i used the new feature in the v0.21 no-default-feature and after running the following command rm -f pixi.lock && pixi install, the lint env is not present in the .pixi/envs folder.

What am i doing wrong?

Expected behavior

both default and lint envs are present and usable.

@vigneshmanick vigneshmanick added the 🐞 bug Something isn't working label May 6, 2024
@ruben-arts
Copy link
Contributor

He @vigneshmanick, this is expected behavior. pixi will only install the required environments. pixi install will install the default environment. But you can specify the required installation with pixi install -e lint.

Most of our other cli tools that interact with the environment also install the required environment. Take for instance pixi run, this will install the required environment for you if requested. pixi run lint will install the lint environment for you.

The pixi install command is there mostly to have a command to call when you really just want to do an installation and nothing else, run shell shell-hook add remove etc will all install the environment you are interacting with when it's required. This is to make sure that your environment will always be in the correct state.

@ruben-arts ruben-arts added 🐞 bug Something isn't working ❓ question Further information is requested and removed 🐞 bug Something isn't working labels May 7, 2024
@ruben-arts ruben-arts changed the title no-default-feature environment not being created Why are not all environments created on pixi install? May 7, 2024
@vigneshmanick
Copy link
Contributor Author

Thanks for the info. This was not clear to me, now running pixi run lint does what you mentioned and the lint env is now there. I have a further point regarding this. When running pixi run lint for the first time i got the following error

pixi run lint
✨ Pixi task (lint-code in lint): ruff check --fix . && ruff format .
  × The current system has a mismatching virtual package. The project requires '__linux' to be at least version '5.10' but the system has version
  │ '3.10.0'

I guess the no-default-feature ignores everything from the default ? would be good if there is a fine grained filter avaialble, platforms, system-requirements , etc. so that i don't have to redefine the fields.

maybe

[no-default-feature]
include = [ "platforms", "system-requirements" ]

@ruben-arts
Copy link
Contributor

The current logic only takes over what is defined in the project table. Specifically channels and platforms. But your point of makes sense. Checkout #1092 to see the full discussion, because there was a pretty big one including your proposal.

The system requirements could be revisited. But for now the fix would be is to redefine them. I posted a different idea for system requirements in general in this Issue.

@vigneshmanick
Copy link
Contributor Author

Your proposal makes sense. I am closing this issue and will followup on the linked ones. Thanks again for the prompt and detailed response.

vigneshmanick added a commit to vigneshmanick/pixi that referenced this issue May 7, 2024
`environment` flag was missing from documentation. Also updated documentation as mentioned in prefix-dev#1333 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working ❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants