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

BUG: Pipe-separated package match specs produce InvalidMatchSpec #1060

Closed
robert-schmidtke opened this issue Sep 12, 2024 · 5 comments
Closed

Comments

@robert-schmidtke
Copy link

Hi, I recently switched from conda/mamba/boa to rattler-build and found that using pipes | in package match specifications produce a final package that cannot be installed using conda or mamba.

package:
  name: rattler-build-test
  version: 0.1.0

source:
  path: ..

build:
  number: 1
  noarch: python
  script: python -m pip install . --no-deps -vv

requirements:
  host:
    - python >=3.10
    - pip >=24.2
    - setuptools >=46.1.0
    - setuptools_scm >=5

  run:
    - python >=3.10
    - pandas >=1.4,<1.5|>=2.2

When trying to install the .conda package that is produced by rattler-build build --recipe ./recipe/recipe.yaml, I see an InvalidMatchSpec:

$ mamba install -n rattler-build-test output/noarch/rattler-build-test-0.1.0-pyh4616a5c_1.conda
$ mamba list -n rattler-build-test
Invalid spec 'pandas (>=1.4,<1.5)|>=2.2': Invalid version '|>=2.2': cannot join single expression

InvalidMatchSpec: Invalid spec 'pandas (>=1.4,<1.5)|>=2.2': Invalid version '|>=2.2': cannot join single expression

I see this spec in both the rattler-build output and the final index.json file:

 │ │ Run dependencies:
 │ │ ╭──────────────────┬────────────────────────╮
 │ │ │ Name             ┆ Spec                   │
 │ │ ╞══════════════════╪════════════════════════╡
 │ │ │ Run dependencies ┆                        │
 │ │ │ python           ┆ >=3.10                 │
 │ │ │ pandas           ┆ (>=1.4,<1.5)|>=2.2     │
 │ │ │ python           ┆ (RE of [host: python]) │
 │ │ ╰──────────────────┴────────────────────────╯

When I drop the pipe from the spec, the final package is working fine.

    - pandas >=1.4,<1.5
 │ │ Run dependencies:
 │ │ ╭──────────────────┬────────────────────────╮
 │ │ │ Name             ┆ Spec                   │
 │ │ ╞══════════════════╪════════════════════════╡
 │ │ │ Run dependencies ┆                        │
 │ │ │ python           ┆ >=3.10                 │
 │ │ │ pandas           ┆ >=1.4,<1.5             │
 │ │ │ python           ┆ (RE of [host: python]) │
 │ │ ╰──────────────────┴────────────────────────╯
$ mamba install -n rattler-build-test output/noarch/rattler-build-test-0.2.0-pyh4616a5c_1.conda
$ conda list -n rattler-build-test
# packages in environment at /home/rschmidtke/miniforge3/envs/rattler-build-test:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
bzip2                     1.0.8                h4bc722e_7    conda-forge
ca-certificates           2024.8.30            hbcca054_0    conda-forge
ld_impl_linux-64          2.40                 hf3520f5_7    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc                    14.1.0               h77fa898_1    conda-forge
libgcc-ng                 14.1.0               h69a702a_1    conda-forge
libgomp                   14.1.0               h77fa898_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libsqlite                 3.46.1               hadc24fc_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.3.1                h4ab18f5_1    conda-forge
ncurses                   6.5                  he02047a_1    conda-forge
openssl                   3.3.2                hb9d3cd8_0    conda-forge
pip                       24.2               pyh8b19718_1    conda-forge
python                    3.10.14         hd12c33a_0_cpython    conda-forge
rattler-build-test        0.2.0              pyh4616a5c_1    file:///home/rschmidtke/workspace/other/rattler-build-test/output
readline                  8.2                  h8228510_1    conda-forge
setuptools                73.0.1             pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tzdata                    2024a                h8827d51_1    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge

Is there anything that I'm doing wrong for the package specification?

It seems to me that the parenthesized expression cannot be parsed by conda and mamba, so I wonder where it comes from and whether it's really necessary to have them, as the specs say that , takes precedence over | anyway: https://conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html#package-match-specifications

I have pushed an MVP here: https://github.com/robert-schmidtke/rattler-build-test

Many thanks for your great work!

@wolfv
Copy link
Member

wolfv commented Sep 12, 2024

Hi @robert-schmidtke - excellent. Thanks a lot for the reproducer. That looks indeed like a bug when rendering the matchspec to text. I am taking a look!

@wolfv
Copy link
Member

wolfv commented Sep 12, 2024

Sadly this seems to hit a bug in conda where MatchSpecs are removing anything between (..) round brackets for reasons that I don't fully understand.

We'll have to think on the best fix. For this case, it would indeed not be necessary to have brackets at all.

Filed a bug upstream as well: conda/conda#14242

And opened a PR in rattler to not print brackets we don't need: conda/rattler#861

@robert-schmidtke
Copy link
Author

Thanks for the quick diagnosis @wolfv! I am going to upvote the upstream issue and stay tuned :)

@wolfv
Copy link
Member

wolfv commented Sep 24, 2024

I am updating rattler so that this is fixed! :)

@wolfv
Copy link
Member

wolfv commented Sep 24, 2024

Fixed with the next release, rattler bumped in #1066.

I'll try to make a release tomorrow! :)

@wolfv wolfv closed this as completed Sep 24, 2024
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