Pytorch for CUDA12.0

Hi I’m trying to install pytorch for CUDA12.0, I have tried multiple ways to install it but constantly getting following error:
I used the following command:

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

ERROR: Could not find a version that satisfies the requirement torchvision (from versions: none)
ERROR: No matching distribution found for torchvision

Can someone please help me out on this ?

It works for me:

pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
...
Successfully installed nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.19.3 nvidia-nvjitlink-cu12-12.1.105 nvidia-nvtx-cu12-12.1.105 pytorch-triton-2.1.0+6e4932cda8 torch-2.2.0.dev20231128+cu121 torchaudio-2.2.0.dev20231128+cu121 torchvision-0.17.0.dev20231128+cu121

Which Python version are you using?

I am using python 3.12.0

Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  • pytorch → python[version=‘>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0’]
  • torchaudio → python[version=‘>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0’]
  • torchvision → python[version=‘>=2.7,<2.8.0a0|>=3.10,<3.11.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.11,<3.12.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0’]

Your python: python=3.12

If python is on the left-most side of the chain, that’s the version you’ve asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with each other:

Output in format: Requested package → Available versions

Package libgcc conflicts for:
pytorch → libgcc
torchvision → pytorch → libgcc

Package pytorch-cuda conflicts for:
torchvision → pytorch-cuda[version=‘11.6.|11.7.|11.8.|12.1.’]
torchaudio → pytorch-cuda[version=‘11.6.|11.7.|11.8.|12.1.’]
pytorch → pytorch-cuda[version=‘>=11.6,<11.7|>=11.7,<11.8|>=11.8,<11.9|>=12.1,<12.2’]
torchaudio → pytorch==2.1.1 → pytorch-cuda[version=‘>=11.6,<11.7|>=11.7,<11.8|>=11.8,<11.9|>=12.1,<12.2’]
torchvision → pytorch==2.1.1 → pytorch-cuda[version=‘>=11.6,<11.7|>=11.7,<11.8|>=11.8,<11.9|>=12.1,<12.2’]

Package ca-certificates conflicts for:
python=3.12 → openssl[version=‘>=3.1.3,<4.0a0’] → ca-certificates
torchvision → python[version=‘>=2.7,<2.8.0a0’] → ca-certificates
pytorch → python[version=‘>=2.7,<2.8.0a0’] → ca-certificates

Package pytorch conflicts for:
torchaudio → pytorch[version=‘1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.13.1|2.0.0|2.0.1|2.1.0|2.1.1|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0|1.5.1’]
torchvision → pytorch[version=‘1.1.|1.10.0|1.10.1|1.10.2|1.11.0|1.12.0|1.12.1|1.13.0|1.13.1|2.0.0|2.0.1|2.1.0|2.1.1|1.9.1|1.9.0|1.8.1|1.8.0|1.7.1|1.7.0|1.6.0|1.5.1|1.7.1.|1.3.1.|1.2.0.|>=0.4|>=0.3’]The following specifications were found to be incompatible with your system:

  • feature:/linux-64::__cuda==12.0=0
  • feature:/linux-64::__glibc==2.31=0
  • feature:|@/linux-64::__cuda==12.0=0
  • python=3.12 → libgcc-ng[version=‘>=11.2.0’] → __glibc[version=‘>=2.17’]
  • pytorch → __cuda[version=‘>=11.8’]
  • pytorch → cudatoolkit[version=‘>=11.3,<11.4’] → __glibc[version=‘>=2.17|>=2.17,<3.0.a0’]
  • torchaudio → cudatoolkit[version=‘>=11.6,<11.7’] → __glibc[version=‘>=2.17,<3.0.a0’]
  • torchaudio → pytorch==2.0.1 → __cuda[version=‘>=11.8’]
  • torchvision → __glibc[version=‘>=2.17,<3.0.a0’]
  • torchvision → libgcc-ng[version=‘>=11.2.0’] → __glibc[version=‘>=2.17’]
  • torchvision → pytorch==2.0.1 → __cuda[version=‘>=11.8’]

Your installed version is: 2.31

This is the error I am getting after I ran : conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

If I downgrade python version I get conflicts with torchaudio and torchvision.

Python 3.12 is not supported yet, if I’m not mistaken, so downgrade to e.g. 3.10.

Thanks a lot! It worked.