`pip download --platform` is not matching compatible wheels?

Hi! I’ve just stumbled an issue trying to download a wheel from PyPI for the specified platform.

E.g. pyradiance==1.1.5 has pyradiance-1.1.5-cp311-cp311-manylinux_2_28_x86_64.whl wheel, which seems to be compatible with glibc 2.28+:

image

When trying to download it with manylinux_2_28_x86_64, it works fine.

python3.11 -m pip download pyradiance==1.1.5 --platform manylinux_2_28_x86_64 --python-version 3.11 --implementation cp --only-binary=:all: --dest=./wheels --no-deps
# Saved ./wheels/pyradiance-1.1.5-cp311-cp311-manylinux_2_28_x86_64.whl

When using manylinux_2_35_x86_64, it fails - though in theory 2.35 is compatible with 2.28.

python3.11 -m pip download pyradiance==1.1.5 --platform manylinux_2_35_x86_64 --python-version 3.11 --implementation cp --only-binary=:all: --dest=./wheels --no-deps
# ERROR: Could not find a version that satisfies the requirement pyradiance==1.1.5 (from versions: 0.4.1, 0.4.2, 0.5.0, 0.5.1, 0.5.2, 0.5.3)
# ERROR: No matching distribution found for pyradiance==1.1.5

Based on the documentation --platform is used to search for wheels compatible with the provided platform, not with the exact platform.

Is it a bug or there’s something else I’m missing here?

I’ve hit this before too. With --target, manylinux tags are matched exactly instead of on a is compatible with basis like the macOS equivalent.

It’s actually really difficult in Python to even just collect wheels when the target platform != current platform.

It’s because tags are treated as opaque strings, not structured data. So there’s no way for pip to know that manylinux_2_28_x86_64 is compatible with manylinux_2_35_x86_64 just like you don’t know if the spam platform is compatible with the eggs platform.

How come --platform=macosx_10_10_x86_64 works then?

1 Like

And also PyPI documents the package as compatible with any version >=2.28:

image

And using pip install pyradiance==1.1.5 works fine installing manylinux_2_28 package on Ubuntu 24.04, which is using glibc 2.39.

So it seems pip in general does consider this tag compatible with later tag versions, but just not in pip download –platform xxx case.

Beats me. Just because the spec treats tags as opaque doesn’t mean others don’t cheat and try to parse them anyway because we try not to randomly change them.