Python packaging unable to find older versions of package

For some reason, this Conda-based .yml installer works:

  - conda-forge
  - pip=22.3.1
  - python=3.10.8
  - pip:
      - torch==1.13.1


pip install torch==1.13.1


ERROR: Could not find a version that satisfies the requirement torch==1.13.1 (from versions: 2.0.0, 2.0.1)
ERROR: No matching distribution found for torch==1.13.1

torch does not ship an sdist, only wheels. Which means in order for pip install torch==1.13.1 to work, torch needs to have uploaded a wheel for your platform and Python version to PyPI. In particular, torch 1.13.1 only ships Python 3.11 wheels for Linux. You can see the list of wheels on PyPI here: torch · PyPI

torch 2.0 and newer ship Python 3.11 wheels for several other platforms.

Expanding a bit further on that explanation, you can browse the versions available on PyPI for a package at, e.g. torch · PyPI , and check the distribution artifacts available for a given release on the files page of that release.

On the latter page you can see that there is no source distribution (sdist, which can be built on any machine the code itself supports, but for highly complex packages like PyTorch can require substantial dependencies and build configuration to work reliable), only built distributions (wheels, are pre-compiled and don’t require specialized build-time dependencies to work).

As a binary package, PyTorch needs to be built specifically for each operating system and Python version it supports, which are reflected in the tags in the wheel filenames on the Files page. As Shantanu mentioned, for CPython 3.11 (cp311), there is only a wheel for Linux (manylinux), not for Windows (win) or Mac (mascosx). By contrast, on the Torach 2.0.1 files page, cp311 wheels for all three platforms (with their various architectures) are available for download.

Ah, I think the Python version is the reason. With an older version of Python, it works.