How to get instantiated dependencies with versions with pixi add
for a feature when an environment hasn't been created yet?
#3944
-
Is it possible from the I'm going to do this all from the command line as this is how students I'm teaching do most things. To demonstrate the question I'm going to show in steps: command line actions, their output, and the effect on a Pixi manifest. First, let's make a Pixi workspace. $ pixi init example
✔ Created /tmp/example/pixi.toml
$ cd example Let's add $ pixi add --feature cpu pytorch-cpu
✔ Added pytorch-cpu
Added these only for feature: cpu [workspace]
channels = ["conda-forge"]
name = "example"
platforms = ["linux-64"]
version = "0.1.0"
[tasks]
[dependencies]
[feature.cpu.dependencies]
pytorch-cpu = "*" Here we see that $ pixi workspace environment add --feature cpu cpu
✔ Added environment cpu [workspace]
channels = ["conda-forge"]
name = "example"
platforms = ["linux-64"]
version = "0.1.0"
[tasks]
[dependencies]
[feature.cpu.dependencies]
pytorch-cpu = "*"
[environments]
cpu = ["cpu"] If we now rerun the command to add $ pixi add --feature cpu pytorch-cpu
✔ Added pytorch-cpu >=1.6.0,<2
Added these only for feature: cpu [workspace]
channels = ["conda-forge"]
name = "example"
platforms = ["linux-64"]
version = "0.1.0"
[tasks]
[dependencies]
[feature.cpu.dependencies]
pytorch-cpu = ">=1.6.0,<2"
[environments]
cpu = ["cpu"] Is it possible to reach this without having to rerun the $ pixi init example
$ cd example
$ pixi add --feature cpu pytorch-cpu
$ pixi workspace environment add --feature cpu cpu
$ pixi add --feature cpu pytorch-cpu We can't just flip the order, as that results in errors. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Hofer-Julian points out in Discord that Example: $ pixi init example
$ cd example
$ pixi add --feature cpu pytorch-cpu
$ pixi workspace environment add --feature cpu cpu
$ pixi upgrade --feature cpu pytorch-cpu resolves as [workspace]
channels = ["conda-forge"]
name = "example"
platforms = ["linux-64"]
version = "0.1.0"
[tasks]
[dependencies]
[feature.cpu.dependencies]
pytorch-cpu = ">=1.6.0,<2"
[environments]
cpu = ["cpu"] Calling Though I'm not sure why it ends up with different version bounds then the |
Beta Was this translation helpful? Give feedback.
@Hofer-Julian points out in Discord that
pixi upgrade
does this.Example:
resolves as
Calling
upgrade
at the end seems slightly unintuitive, but I guess that's force things to be resolved by asking it to upgrade given thatpixi upgrade
pixi/docs/reference/cli/pixi/upgrade.md
Line 5 in 1044612