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

pixi shell should only pull the requested environment, not all environments. #2114

Open
sebastian-sz opened this issue Sep 23, 2024 · 2 comments

Comments

@sebastian-sz
Copy link

Problem description

TL;DR pixi shell pulls ALL environments, even when only the default is requested.

I'm rolling a Pytorch CPU / GPU project. linux-64 uses GPU and CPU, everything else is CPU. Please find the pyproject.toml below:

[project]
authors = [{name = "Sebastian Sz", email = "***@***.com"}]
dependencies = ["jaxtyping>=0.2.34,<0.3"]
description = "Add a short description here"
name = "torch-proj"
requires-python = ">= 3.9, <3.13"
version = "0.1.0"

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

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

[tool.pixi.dependencies]
pytorch = {version = "2.4.1", channel = "pytorch"}
torchvision = {version = "0.19.1", channel = "pytorch" }

[tool.pixi.pypi-dependencies]
torch-proj = { path = ".", editable = true }

[tool.pixi.tasks]

[tool.pixi.environments]
cuda = ["cuda"]

# CUDA setup
[tool.pixi.feature.cuda]
platforms = ["linux-64"]
channels = ["nvidia/label/cuda-12.4.0", "nvidia", "conda-forge", "pytorch"]

[tool.pixi.feature.cuda.dependencies]
pytorch-cuda = {version = "12.4.*", channel = "pytorch"}

The issue is: when running pixi shell on Linux, the cuda environment gets downloaded and installed, even though I did not request cuda. This is kinda bloaty, e.g. when I want to run CI on Linux on the CPU there is no reason to pull the Nvidia's packages (which are quite heavy).

Ideally, we would pull cuda only when requested, e.g:
pixi shell <- downloads CPU only packages
pixi shell -e cuda <- downloads CUDA only packages

Rather then have everything possible downloaded, regardless of the environment.

Pixi version: 0.30.0

@sebastian-sz
Copy link
Author

The vice versa also holds: I shouldn't have to pull cpu environment if I plan to use cuda only.

If there is any change I can do in my workflow, please don't hesitate to let me know!

@ruben-arts
Copy link
Contributor

The problem your having is caused by our requirement to install the conda environments to solve for the pypi dependencies. What you require for this to work is the feature requested in: #1046

What you could try for now is a pip install --editable . task, instead of the following configuration:

[tool.pixi.pypi-dependencies]
torch-proj = { path = ".", editable = true }

This would avoid the installation to only when you need it instead of requiring the environment at solve time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants