Search code examples
pythonpip

How to troubleshoot when pip does not show all package versions


I want to install a specific version of a package through pip.

However, when trying to install pytorch v2.4.1 on my M1 Macbook with pip install torch==2.4.1 I get:

ERROR: Could not find a version that satisfies the requirement torch==2.4.1 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2)
ERROR: No matching distribution found for torch==2.4.1

Presumably Python version, OS or Hardware is not compatible with versions >2.2.2 of pytorch. How can I work out which it is?

I've tried with different Python versions, so I suspect it's hardware. pip index versions torch does not list versions above 2.2.2


Solution

  • Attempt install with increased verbosity, like this:

    pip install torch==2.4.1 -vv
    

    Now there will be log messages which say why some versions have been excluded by your package finder when crawling the index, e.g.:

    $ pip install torch==2.4.1 -vv | grep Skipping
    ...
    Skipping link: none of the wheel's tags (cp39-cp39-win_amd64) are compatible (run pip debug --verbose to show compatible tags): https://files.pythonhosted.org/packages/76/49/4a0a8b19ce8f9bf32fcab4e863c7e2366f519f9826c84ca250567b11a014/torch-2.5.1-cp39-cp39-win_amd64.whl (from https://pypi.org/simple/torch/) (requires-python:>=3.8.0)
    ...
    

    There will likely be many versions excluded by wheel compatibility tags due to mismatched platform and Python verson.

    For torch wheels specifically, you may want to look at the PyTorch index instead of at PyPI. There are a lot more options available - https://download.pytorch.org/whl/torch/