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

Different solver behavior based on how build string in requirement is spelled #604

Open
2 tasks done
jameslamb opened this issue Jan 20, 2025 · 2 comments
Open
2 tasks done
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@jameslamb
Copy link

jameslamb commented Jan 20, 2025

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

Trying to create an environment on an x86_64 macOS system, I've found that the behavior of conda install appears to differ based on how I spell the Python requirement.

# solve fails with 'LibMambaUnsatisfiableError'
'python=3.9=*_cp*'

# solve succeeds
'python=3.9[build=*_cp*]'

I'd expected these to be different spellings that translate to identical representations for the solver, and therefore to not affect solves at all.

Conda Info

output of 'conda info' (click me)
active environment : None
            shell level : 0
       user config file : /Users/jlamb/.condarc
 populated config files : /Users/jlamb/miniforge/.condarc
                          /Users/jlamb/.condarc
          conda version : 24.11.3
    conda-build version : not installed
         python version : 3.10.16.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=24.11.3=0
                          __osx=12.7.4=0
                          __unix=0=0
       base environment : /Users/jlamb/miniforge  (writable)
      conda av data dir : /Users/jlamb/miniforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/jlamb/miniforge/pkgs
                          /Users/jlamb/.conda/pkgs
       envs directories : /Users/jlamb/miniforge/envs
                          /Users/jlamb/.conda/envs
               platform : osx-64
             user-agent : conda/24.11.3 requests/2.32.3 CPython/3.10.16 Darwin/21.6.0 OSX/12.7.4 solver/libmamba conda-libmamba-solver/24.11.1 libmambapy/2.0.5
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Conda Config

==> /Users/jlamb/miniforge/.condarc <==
channels:
  - conda-forge

==> /Users/jlamb/.condarc <==
channels:
  - conda-forge
  - defaults
anaconda_upload: False
conda_build:
  pkg_format: 1
  zstd_compression_level: 19

Conda list

output of 'conda list' (click me)
# packages in environment at /Users/jlamb/miniforge:
#
# Name                    Version                   Build  Channel
archspec                  0.2.5              pyhd8ed1ab_0    conda-forge
boltons                   24.0.0             pyhd8ed1ab_1    conda-forge
brotli-python             1.1.0           py310h53e7c6a_2    conda-forge
bzip2                     1.0.8                hfdf4475_7    conda-forge
c-ares                    1.34.4               hf13058a_0    conda-forge
ca-certificates           2024.12.14           h8857fd0_0    conda-forge
certifi                   2024.12.14         pyhd8ed1ab_0    conda-forge
cffi                      1.17.1          py310hfce808e_0    conda-forge
charset-normalizer        3.4.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_1    conda-forge
conda                     24.11.3         py310h2ec42d9_0    conda-forge
conda-libmamba-solver     24.11.1            pyhd8ed1ab_0    conda-forge
conda-package-handling    2.4.0              pyh7900ff3_2    conda-forge
conda-package-streaming   0.11.0             pyhd8ed1ab_0    conda-forge
cpp-expected              1.1.0                hb8565cd_0    conda-forge
distro                    1.9.0              pyhd8ed1ab_1    conda-forge
fmt                       11.0.2               h3c5361c_0    conda-forge
frozendict                2.4.6           py310hb9d19b6_0    conda-forge
h2                        4.1.0              pyhd8ed1ab_1    conda-forge
hpack                     4.0.0              pyhd8ed1ab_1    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_1    conda-forge
icu                       75.1                 h120a0e1_0    conda-forge
idna                      3.10               pyhd8ed1ab_1    conda-forge
jsonpatch                 1.33               pyhd8ed1ab_1    conda-forge
jsonpointer               3.0.0           py310h2ec42d9_1    conda-forge
krb5                      1.21.3               h37d8d59_0    conda-forge
libarchive                3.7.7                h1a33361_3    conda-forge
libcurl                   8.11.1               h5dec5d8_0    conda-forge
libcxx                    19.1.7               hf95d169_0    conda-forge
libedit                   3.1.20240808    pl5321ha958ccf_0    conda-forge
libev                     4.33                 h10d778d_2    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libiconv                  1.17                 hd75f5a5_2    conda-forge
liblzma                   5.6.3                hd471939_1    conda-forge
liblzma-devel             5.6.3                hd471939_1    conda-forge
libmamba                  2.0.5                h415aaf8_1    conda-forge
libmambapy                2.0.5           py310h00609fd_1    conda-forge
libnghttp2                1.64.0               hc7306c3_0    conda-forge
libsolv                   0.7.30               h69d5d9b_0    conda-forge
libsqlite                 3.48.0               hdb6dae5_0    conda-forge
libssh2                   1.11.1               h3dc7d44_0    conda-forge
libxml2                   2.13.5               hebb159f_1    conda-forge
libzlib                   1.3.1                hd23fc13_2    conda-forge
lz4-c                     1.10.0               h240833e_1    conda-forge
lzo                       2.10              h10d778d_1001    conda-forge
mamba                     2.0.5                h82323bd_1    conda-forge
menuinst                  2.2.0           py310h2ec42d9_0    conda-forge
ncurses                   6.5                  h0622a9a_2    conda-forge
nlohmann_json             3.11.3               hf036a51_1    conda-forge
openssl                   3.4.0                hc426f3f_1    conda-forge
packaging                 24.2               pyhd8ed1ab_2    conda-forge
pip                       24.3.1             pyh8b19718_2    conda-forge
platformdirs              4.3.6              pyhd8ed1ab_1    conda-forge
pluggy                    1.5.0              pyhd8ed1ab_1    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.6           py310hbb8c376_2    conda-forge
pycparser                 2.22               pyh29332c3_1    conda-forge
pysocks                   1.7.1              pyha55dd90_7    conda-forge
python                    3.10.16         h5acdff8_1_cpython    conda-forge
python_abi                3.10                    5_cp310    conda-forge
pyyaml                    6.0.1                    pypi_0    pypi
readline                  8.2                  h9e318b2_1    conda-forge
reproc                    14.2.5.post0         h6e16a3a_0    conda-forge
reproc-cpp                14.2.5.post0         h240833e_0    conda-forge
requests                  2.32.3             pyhd8ed1ab_1    conda-forge
ruamel.yaml               0.18.10         py310hbb8c376_0    conda-forge
ruamel.yaml.clib          0.2.8           py310hb9d19b6_1    conda-forge
setuptools                75.8.0             pyhff2d567_0    conda-forge
simdjson                  3.11.6               h9275861_0    conda-forge
spdlog                    1.15.0               h0ec5880_0    conda-forge
tk                        8.6.13               h1abcd95_1    conda-forge
tqdm                      4.67.1             pyhd8ed1ab_1    conda-forge
truststore                0.10.0             pyhd8ed1ab_0    conda-forge
tzdata                    2025a                h78e105d_0    conda-forge
urllib3                   2.3.0              pyhd8ed1ab_0    conda-forge
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
xz                        5.6.3                h357f2ed_1    conda-forge
xz-gpl-tools              5.6.3                h357f2ed_1    conda-forge
xz-tools                  5.6.3                hd471939_1    conda-forge
yaml-cpp                  0.8.0                he965462_0    conda-forge
zstandard                 0.23.0          py310h41d873f_1    conda-forge
zstd                      1.5.6                h915ae27_0    conda-forge

Additional Context

Reproducible Example

This fails:

conda create \
    --override-channels \
    -c conda-forge \
    -c nodefaults \
    -y \
    --dry-run \
    -n delete-me \
    --file ./.ci/conda-envs/ci-core.txt \
    'python=3.9=*_cp*'
Solving environment: failed

LibMambaUnsatisfiableError: Encountered problems while solving:
  - package cffi-1.17.1-py39h8ddeee6_0 requires libffi >=3.4,<4.0a0, but none of the providers can be installed
full logs (click me)
Channels:                                                                                                                                                 
 - conda-forge                                                                                                                                            
 - nodefaults                                                                                                                                             
Platform: osx-64                                                                                                                                          
Collecting package metadata (repodata.json): done                                                                                                         
Solving environment: failed

LibMambaUnsatisfiableError: Encountered problems while solving:
  - package cffi-1.17.1-py39h8ddeee6_0 requires libffi >=3.4,<4.0a0, but none of the providers can be installed

Could not solve for environment specs
The following packages are incompatible
├─ cffi >=1.16 * is installable with the potential options
│  ├─ cffi [1.16.0|1.17.0|1.17.1] would require
│  │  └─ python_abi =3.10 *_cp310, which can be installed;
│  ├─ cffi [1.16.0|1.17.0|1.17.1] would require
│  │  └─ python_abi =3.11 *_cp311, which can be installed;
│  ├─ cffi [1.16.0|1.17.0|1.17.1] would require
│  │  └─ python_abi =3.12 *_cp312, which can be installed;
│  ├─ cffi [1.16.0|1.17.0] would require
│  │  └─ python_abi =3.8 *_cp38, which can be installed;
│  ├─ cffi [1.16.0|1.17.0|1.17.1] would require
│  │  └─ libffi >=3.4,<4.0a0 *, which can be installed;
│  ├─ cffi [1.16.0|1.17.0] would require
│  │  └─ python_abi ==3.9 *_pypy39_pp73 with the potential options
│  │     ├─ python_abi 3.9, which can be installed;
│  │     └─ python_abi 3.9 would require
│  │        └─ python =3.9 *_73_pypy, which can be installed;
│  └─ cffi [1.17.0|1.17.1] would require
│     └─ python_abi =3.13 *_cp313, which can be installed;
└─ python ==3.9 *_cp* is not installable because there are no viable options
   ├─ python 3.9.0 would require
   │  ├─ libffi >=3.2.1,<3.3.0a0 *, which conflicts with any installable versions previously reported;
   │  └─ python_abi =3.9 *_cp39, which conflicts with any installable versions previously reported;
   └─ python 3.9.0 would require
      ├─ libffi >=3.3,<3.4.0a0 *, which conflicts with any installable versions previously reported;
      └─ python_abi =3.9 *_cp39, which conflicts with any installable versions previously reported.

The following succeeds. Notice that the only difference is the spelling of the python requirement.

conda create \
    --override-channels \
    -c conda-forge \
    -c nodefaults \
    -y \
    --dry-run \
    -n delete-me \
    'cffi>=1.16' \
    'pyarrow-core>=6.0' \
    'python=3.9[build=*_cp*]'
full logs (click me)
```text
## Package Plan ##

  environment location: /Users/jlamb/miniforge/envs/delete-me

  added / updated specs:
    - cffi[version='>=1.16']
    - pyarrow-core[version='>=6.0']
    - python=3.9[build=*_cp*]


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    aws-c-auth-0.8.0           |      h6661f4c_16          92 KB  conda-forge
    aws-c-cal-0.8.1            |       hc0df2db_3          38 KB  conda-forge
    aws-c-common-0.10.6        |       h6e16a3a_0         222 KB  conda-forge
    aws-c-compression-0.3.0    |       hc0df2db_5          18 KB  conda-forge
    aws-c-event-stream-0.5.0   |      h8236443_11          46 KB  conda-forge
    aws-c-http-0.9.2           |       h5492b4a_4         161 KB  conda-forge
    aws-c-io-0.15.3            |       h7bd4489_6         135 KB  conda-forge
    aws-c-mqtt-0.11.0          |      h3488609_12         160 KB  conda-forge
    aws-c-s3-0.7.9             |       ha6e97d4_0          97 KB  conda-forge
    aws-c-sdkutils-0.2.2       |       hc0df2db_0          50 KB  conda-forge
    aws-checksums-0.2.2        |       hc0df2db_4          69 KB  conda-forge
    aws-crt-cpp-0.29.9         |       hd3bd598_1         291 KB  conda-forge
    aws-sdk-cpp-1.11.458       |       h904bc55_6         2.8 MB  conda-forge
    azure-core-cpp-1.14.0      |       h9a36307_0         296 KB  conda-forge
    azure-identity-cpp-1.10.0  |       ha4e2ba9_0         171 KB  conda-forge
    azure-storage-blobs-cpp-12.13.0|       h3d2f5f1_1         435 KB  conda-forge
    azure-storage-common-cpp-12.8.0|       h1ccc5ac_1         123 KB  conda-forge
    azure-storage-files-datalake-cpp-12.12.0|       h86941f0_1         196 KB  conda-forge
    cffi-1.17.1                |   py39h8ddeee6_0         224 KB  conda-forge
    gflags-2.2.2               |    hac325c4_1005          83 KB  conda-forge
    glog-0.7.1                 |       h2790a97_0         114 KB  conda-forge
    libabseil-20240722.0       | cxx17_h0e468a2_4         1.1 MB  conda-forge
    libarrow-19.0.0            |   hc7ff7ea_3_cpu         5.9 MB  conda-forge
    libbrotlicommon-1.1.0      |       h00291cd_2          66 KB  conda-forge
    libbrotlidec-1.1.0         |       h00291cd_2          29 KB  conda-forge
    libbrotlienc-1.1.0         |       h00291cd_2         289 KB  conda-forge
    libgoogle-cloud-2.33.0     |       h7000a09_1         873 KB  conda-forge
    libgoogle-cloud-storage-2.33.0|       h3f2b517_1         529 KB  conda-forge
    libgrpc-1.67.1             |       h4896ac0_1         5.2 MB  conda-forge
    libprotobuf-5.28.3         |       h6401091_1         2.2 MB  conda-forge
    libre2-11-2024.07.02       |       h0e468a2_2         175 KB  conda-forge
    libutf8proc-2.10.0         |       h777c5d8_0          78 KB  conda-forge
    libxml2-2.13.5             |       he8ee3e7_1         595 KB  conda-forge
    orc-2.0.3                  |       h85ea3fe_2         456 KB  conda-forge
    pyarrow-core-19.0.0        |py39h6e815d7_0_cpu         3.9 MB  conda-forge
    python-3.9.21              |h7fafba3_1_cpython        10.9 MB  conda-forge
    python_abi-3.9             |           5_cp39           6 KB  conda-forge
    re2-2024.07.02             |       ha5e900a_2          26 KB  conda-forge
    snappy-1.2.1               |       haf3c120_1          36 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        38.0 MB

The following NEW packages will be INSTALLED:

  aws-c-auth         conda-forge/osx-64::aws-c-auth-0.8.0-h6661f4c_16 
  aws-c-cal          conda-forge/osx-64::aws-c-cal-0.8.1-hc0df2db_3 
  aws-c-common       conda-forge/osx-64::aws-c-common-0.10.6-h6e16a3a_0 
  aws-c-compression  conda-forge/osx-64::aws-c-compression-0.3.0-hc0df2db_5 
  aws-c-event-stream conda-forge/osx-64::aws-c-event-stream-0.5.0-h8236443_11 
  aws-c-http         conda-forge/osx-64::aws-c-http-0.9.2-h5492b4a_4 
  aws-c-io           conda-forge/osx-64::aws-c-io-0.15.3-h7bd4489_6 
  aws-c-mqtt         conda-forge/osx-64::aws-c-mqtt-0.11.0-h3488609_12 
  aws-c-s3           conda-forge/osx-64::aws-c-s3-0.7.9-ha6e97d4_0 
  aws-c-sdkutils     conda-forge/osx-64::aws-c-sdkutils-0.2.2-hc0df2db_0 
  aws-checksums      conda-forge/osx-64::aws-checksums-0.2.2-hc0df2db_4 
  aws-crt-cpp        conda-forge/osx-64::aws-crt-cpp-0.29.9-hd3bd598_1 
  aws-sdk-cpp        conda-forge/osx-64::aws-sdk-cpp-1.11.458-h904bc55_6 
  azure-core-cpp     conda-forge/osx-64::azure-core-cpp-1.14.0-h9a36307_0 
  azure-identity-cpp conda-forge/osx-64::azure-identity-cpp-1.10.0-ha4e2ba9_0 
  azure-storage-blo~ conda-forge/osx-64::azure-storage-blobs-cpp-12.13.0-h3d2f5f1_1 
  azure-storage-com~ conda-forge/osx-64::azure-storage-common-cpp-12.8.0-h1ccc5ac_1 
  azure-storage-fil~ conda-forge/osx-64::azure-storage-files-datalake-cpp-12.12.0-h86941f0_1 
  bzip2              conda-forge/osx-64::bzip2-1.0.8-hfdf4475_7 
  c-ares             conda-forge/osx-64::c-ares-1.34.4-hf13058a_0 
  ca-certificates    conda-forge/osx-64::ca-certificates-2024.12.14-h8857fd0_0 
  cffi               conda-forge/osx-64::cffi-1.17.1-py39h8ddeee6_0 
  gflags             conda-forge/osx-64::gflags-2.2.2-hac325c4_1005 
  glog               conda-forge/osx-64::glog-0.7.1-h2790a97_0 
  krb5               conda-forge/osx-64::krb5-1.21.3-h37d8d59_0 
  libabseil          conda-forge/osx-64::libabseil-20240722.0-cxx17_h0e468a2_4 
  libarrow           conda-forge/osx-64::libarrow-19.0.0-hc7ff7ea_3_cpu 
  libbrotlicommon    conda-forge/osx-64::libbrotlicommon-1.1.0-h00291cd_2 
  libbrotlidec       conda-forge/osx-64::libbrotlidec-1.1.0-h00291cd_2 
  libbrotlienc       conda-forge/osx-64::libbrotlienc-1.1.0-h00291cd_2 
  libcrc32c          conda-forge/osx-64::libcrc32c-1.1.2-he49afe7_0 
  libcurl            conda-forge/osx-64::libcurl-8.11.1-h5dec5d8_0 
  libcxx             conda-forge/osx-64::libcxx-19.1.7-hf95d169_0 
  libedit            conda-forge/osx-64::libedit-3.1.20240808-pl5321ha958ccf_0 
  libev              conda-forge/osx-64::libev-4.33-h10d778d_2 
  libffi             conda-forge/osx-64::libffi-3.4.2-h0d85af4_5 
  libgoogle-cloud    conda-forge/osx-64::libgoogle-cloud-2.33.0-h7000a09_1 
  libgoogle-cloud-s~ conda-forge/osx-64::libgoogle-cloud-storage-2.33.0-h3f2b517_1 
  libgrpc            conda-forge/osx-64::libgrpc-1.67.1-h4896ac0_1 
  libiconv           conda-forge/osx-64::libiconv-1.17-hd75f5a5_2 
  liblzma            conda-forge/osx-64::liblzma-5.6.3-hd471939_1 
  libnghttp2         conda-forge/osx-64::libnghttp2-1.64.0-hc7306c3_0 
  libprotobuf        conda-forge/osx-64::libprotobuf-5.28.3-h6401091_1 
  libre2-11          conda-forge/osx-64::libre2-11-2024.07.02-h0e468a2_2 
  libsqlite          conda-forge/osx-64::libsqlite-3.48.0-hdb6dae5_0 
  libssh2            conda-forge/osx-64::libssh2-1.11.1-h3dc7d44_0 
  libutf8proc        conda-forge/osx-64::libutf8proc-2.10.0-h777c5d8_0 
  libxml2            conda-forge/osx-64::libxml2-2.13.5-he8ee3e7_1 
  libzlib            conda-forge/osx-64::libzlib-1.3.1-hd23fc13_2 
  lz4-c              conda-forge/osx-64::lz4-c-1.10.0-h240833e_1 
  ncurses            conda-forge/osx-64::ncurses-6.5-h0622a9a_2 
  openssl            conda-forge/osx-64::openssl-3.4.0-hc426f3f_1 
  orc                conda-forge/osx-64::orc-2.0.3-h85ea3fe_2 
  pip                conda-forge/noarch::pip-24.3.1-pyh8b19718_2 
  pyarrow-core       conda-forge/osx-64::pyarrow-core-19.0.0-py39h6e815d7_0_cpu 
  pycparser          conda-forge/noarch::pycparser-2.22-pyh29332c3_1 
  python             conda-forge/osx-64::python-3.9.21-h7fafba3_1_cpython 
  python_abi         conda-forge/osx-64::python_abi-3.9-5_cp39 
  re2                conda-forge/osx-64::re2-2024.07.02-ha5e900a_2 
  readline           conda-forge/osx-64::readline-8.2-h9e318b2_1 
  setuptools         conda-forge/noarch::setuptools-75.8.0-pyhff2d567_0 
  snappy             conda-forge/osx-64::snappy-1.2.1-haf3c120_1 
  tk                 conda-forge/osx-64::tk-8.6.13-h1abcd95_1 
  tzdata             conda-forge/noarch::tzdata-2025a-h78e105d_0 
  wheel              conda-forge/noarch::wheel-0.45.1-pyhd8ed1ab_1 
  zstd               conda-forge/osx-64::zstd-1.5.6-h915ae27_0 


DryRunExit: Dry run. Exiting.

</details>

### Related Issues

I searched for other related issues and didn't find anything that looked exactly like this. Though these seem like they could be related:

* https://github.com/conda/conda-libmamba-solver/issues/591
* https://github.com/conda/conda/issues/14357
* https://github.com/conda/conda-libmamba-solver/issues/581

Sorry in advance if this is in the wrong place to report that... I wasn't sure whether this belonger here, in `conda/conda`, in `mamba-org/mamba`, or somewhere else.

### Other Notes

This behavior is surprising... I'd expect those 2 specs to result in identical behavior from the solver. I followed the approach uses in https://github.com/mamba-org/mamba/issues/3647 and saw that they result in seemingly-identical`MatchSpec` objects in `libmambapy`.

```python
from libmambapy.specs import MatchSpec

spec1 = MatchSpec.parse("python=3.9=*_cp*")
print(spec1)
# python[version="=3.9",build="*_cp*"]

spec2 = MatchSpec.parse("python=3.9[build=*_cp*]")
print(spec2)
# python[version="=3.9",build="*_cp*"]

I do see that the two MatchSpec objects do not compare equal, though I'm not sure where the differences are.

assert spec1 == spec2
# False
@jameslamb jameslamb added the type::bug describes erroneous operation, use severity::* to classify the type label Jan 20, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Jan 20, 2025
@jaimergp
Copy link
Contributor

Can you try with python=3.9.*=*_cp*? I think there's some roundtrip problem there that makes =3.9 turn into ==3.9.

@jameslamb
Copy link
Author

Sure!

Just tried with the example code I provide above, but using python=3.9.*=*_cp*... results in the same (successful) solve as python=3.9[build=*_cp*].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants