Search code examples
pythonpython-3.xpippytorch

Is there a way to install pytorch on python 3.12.0?


I'm making an app using gpt-neo and I'm trying to install torch, but it won't install.

The error message is as follows:

C:\Users\Ben>pip install torch
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

Is there any way to install torch without pip?


Solution

  • There are now released versions of pytorch available for python 3.12, starting with pytorch 2.2

    There should be no need to use the pre-release nightly build for cuda 11.8 and python 3.12, at least there seems to be installation candidates in https://download.pytorch.org/whl/cu118 for python 3.12:

    torch-2.2.0+cu118-cp312-cp312-linux_x86_64.whl
    torch-2.2.0+cu118-cp312-cp312-win_amd64.whl

    So at least on windows and linux, you should be able to do

    pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
    

    for a cuda enabled installation of pytorch