Can't to install PyTorch for CUDA 12.4

Colleagues,

problem solved. The issue was simple I wasn’t read the PyTorch site good enough. Especcialy that part that generates for anaconda command. As of Apr-12-2024, this banner showed that minimum required version of python is >= 3.8, and i was setup my environment for python 3.7. so 2 commands fixed everything:

  1. conda create --name my_env python=3.10
  2. conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

Then as suggested by ptrblck in Torch not compiled with CUDA enabled - #22 by ptrblck
Run several commands to check if all good:

1. Python
2. >>> import torch
3. >>> torch.version.cuda
'11.8'
4. >>> torch.__version__
'2.0.0'
5. >>> x = torch.randn(1).cuda()
6. >>> x
tensor([1.7900], device='cuda:0')

NOTE: Make sure you have installed CUDA 12.1 along with appropriate version of CuDNN

2 Likes