Search code examples
pythonlinuxpippython-wheel

Wheels created by "pip freeze" and "pip wheel" not usable with --no-index and --find-links?


I created wheels from an existing venv, that resulted in, among others, the following wheel. The wheel was created within docker, with a Python version of 3.9 (the smallest possible versions were chosen to provide maximal compatibility)

wheels/codechecker-6.23.1-cp39-cp39-linux_x86_64.whl

My requirements.txt has that version "6.23.1" listed. But when I try to install that version (with Python 3.11), using

python3 -m pip install --no-index --find-links wheels -r requirements.txt

Python gives an error message:

Looking in links: wheels
Processing wheels/alembic-1.5.5-py2.py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement codechecker==6.23.1 (from > versions: none)
ERROR: No matching distribution found for codechecker==6.23.1

My suspicion is that the version encoding of "cp39" (for CPython3.9) somehow gets in the way with using it with CPython3.11, but from what I read, wheels should be upward-compatible and Pip should be downward compatible with older wheel versions. So what could be wrong here? Both systems are 64bit systems.


Solution

  • wheels/codechecker-6.23.1- cp39-cp39

    vs

    "But when I try to install that version (with Python 3.11)"

    "wheels should be upward-compatible"

    No, binary wheels can only be installed to exactly same platform (major Python version, OS, processor). You can create a binary wheel with Python 3.9.8 and install to 3.9.6 but not to 3.11.

    Universal wheels like alembic-1.5.5-py2.py3-none-any.whl can be installed to any version/