Search code examples
pythonpytorch

how to find what is the latest version of python that pytorch


When I try pip install torch, I get

ERROR: Could not find a version that satisfies the requirement torch (from versions: none)

ERROR: No matching distribution found for torch

Searching on here stackoverflow I find that the issue is I need an older verson of python, currently I'm using 3.11. That post said 3.8 but was written some time ago, so how do I find the latest version of python that will run pytorch? I couldn't find it easily on the PyTorch pages.


Solution

  • You can always check torch archive or torch nightly to see if your desired version is supported.
    While the Python3.11 is not officially supported as of now (Feb 11, 2023), if you are on Linux you can install the Python3.11 version of Pytorch 1.13.1:

    wget https://download.pytorch.org/whl/cu117/torch-1.13.1%2Bcu117-cp311-cp311-linux_x86_64.whl 
    pip3 install torch-1.13.1+cu117-cp311-cp311-linux_x86_64.whl
    

    Just note that this is not yet available on Windows or other major OSes. If you want to give the new version a try on Other OSes such as Windows or Mac, you need to use the nighly builds.
    For example for Windows inside powershell do :

    wget https://download.pytorch.org/whl/nightly/cu117/torch-2.0.0.dev20230210%2Bcu117-cp311-cp311-win_amd64.whl -OutFile torch-2.0.0.dev20230210+cu117-cp311-cp311-win_amd64.whl
    pip install torch-2.0.0.dev20230210+cu117-cp311-cp311-win_amd64.whl