prefix-dev / pixi

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

pixi search pyqt returns incorrect version/python version build #970

Open synapticarbors opened 3 months ago

synapticarbors commented 3 months ago

Checks

Reproducible example

❯ pixi --version
pixi 0.16.1
❯ pixi search pyqt

pyqt py39h3dce684_5
-------------------

Name                pyqt
Version             5.15.9
Build               py39h3dce684_5
Size                4067571
License             GPL-3.0-only
Subdir              osx-64
File Name           pyqt-5.15.9-py39h3dce684_5.conda
URL                 https://conda.anaconda.org/conda-forge/osx-64/pyqt-5.15.9-py39h3dce684_5.conda
MD5                 ecc396e7a7badba032c3f9dd30c40e9c
SHA256              58e3f096357bc899fa446bc9ff28cf04feaa3cb7b394b2fcf7e4facce442ff72

Dependencies:
 - libcxx >=15.0.7
 - pyqt5-sip 12.12.2 py39hb11a7c1_5
 - python >=3.9,<3.10.0a0
 - python_abi 3.9.* *_cp39
 - qt-main >=5.15.8,<5.16.0a0
 - sip >=6.7.11,<6.8.0a0

Issue description

pixi search pyqt returns the correct major version, but shows the dependencies/build for an older version of python. In the above, it's showing the build for python3.9. Running pixi add python pyqt on a clean project, gets the build for the latest python3.12 as expected (inspecting the pixi.lock file).

This seems similar but not exactly the same as https://github.com/prefix-dev/pixi/issues/712, and might be confusing because it looks like pyqt isn't built for the latest version of python.

Expected behavior

I would expect pixi search (given the help description of "Search a package, output will list the latest version of package"), to give me the latest build, or the latest build consistent with the dependencies already specified in the project.

chawyehsu commented 3 months ago

Confirmed. Now there should be a codebase refactor to abstract logic of how pixi add determine and add packages and share it with pixi search to eliminate package solving differences between these two commands.

wolfv commented 3 months ago

I am not sure if properly "solving" would be the correct solution since users expect search to return any available versions (not only the ones that would resolve properly).

However, we should use the same comparison functions that we use for determining the best package (the package we try first when solving). This is implemented in rattler, in the conda_util.rs file. Unfortunately that is not easily re-useable outside of the solver.

In the meantime we could also print all available variants of a package version and do some other (maybe simpler) comparison operation.

ruben-arts commented 3 months ago

This issue also requests a more verbose output of pixi search https://github.com/prefix-dev/pixi/issues/869