prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
2.46k stars 138 forks source link

Allow disambiguation when packages are present in multiple channels #1560

Closed corneliusroemer closed 1 week ago

corneliusroemer commented 2 weeks ago

Problem description

It can happen that the same package name is available in multiple channels. Example: tsv-utils is in both conda-forge and bioconda.

Is there a way to tell pixi which one to use? I tried "bioconda::tsv-utils" which conda supports but doesn't seem to work here:

    ╭─[pixi.toml:13:1]
 12 │ cowpy = ">=1.1.5,<1.2"
 13 │ "bioconda::tsv-utils" = ">=2.2.0,<2.3"
    · ──────────┬──────────
    ·           ╰── 'bioconda::tsv-utils' is not a valid package name. Package names can only contain 0-9, a-z, A-Z, -, _, or .
 14 │ 
    ╰────

Is there a different way?

It seems that you use strict channel priority and don't allow a way to override it for individual packages?

Yura52 commented 1 week ago

Yes, you can specify channels for individual packages. To make it work, the new channel also must be added to the channels list.

[project]
channels = ["conda-forge", "bioconda"]

[dependencies]
cowpy = ">=1.1.5,<1.2"
tsv-utils = {version = ">=2.2.0,<2.3", channel = "bioconda"}

More info here: https://pixi.sh/latest/advanced/channel_priority/ (in particular, see the example).

ruben-arts commented 1 week ago

For those finding this Issue, @Yura52 is correct!

You can do this through the cli with:

pixi project channel add bioconda
pixi add bioconda::tsv-utlils
corneliusroemer commented 1 week ago

Excellent, thanks for explaining how to do this @Yura52 and @ruben-arts!