Search code examples
pythonpippypi

Why does pip not find the newest version of a package even if it exists?


Someone at work created a sample Dockerfile/project/image for new employees to get their feet wet. However, while trying to run the script to build the image, it's complaining about Python module versions that don't fulfill the requirement.

One module is bidict. The requirements.txt file is asking for 0.21.0. I found the version exists here, however, the error message I get back says the latest version it found is 0.18.4.

Collecting bidict==0.21.0
  ERROR: Could not find a version that satisfies the requirement bidict==0.21.0 (from versions: 0.1.5, 0.2.1, 0.3.0, 0.3.1, 0.9.0rc0, 0.9.0.post1, 0.10.0, 0.10.0.post1, 0.11.0, 0.12.0.post1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.15.0.dev0, 0.15.0.dev1, 0.15.0rc1, 0.15.0, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4)
ERROR: No matching distribution found for bidict==0.21.0

How do I figure out which Python module repo the image is looking/pointing at so I can update it to something else that sees newer versions of modules?


Solution

  • The mere existence of version in https://pypi.org/project/bidict/#history is not enough for pip to use it. Pip checks Python version compatibility and processor architecture for binary wheels.

    bidict 0.18.4 was the last version that did not declare Python version compatibility. Starting from 0.19.0 the project declares "Requires: Python >=3". 0.21.0 declares "Requires: Python >=3.6".

    From the list of compatible versions I guess you use Python 2.7 (you should have indicated that in the question) so you can only use version 0.18.4 and lower. For higher versions upgrade Python to 3.6+ (but upgrading from 2.7 is quite hard usually).