Can't to install PyTorch for CUDA 12.4

Hi Team,

I know my topic looks somehow similar to this one Trying (and failing) to install PyTorch for CUDA 12.0
I tried what is written there and for some reasons it’s not work for me.

Laptop environment setup

  • Windows 11 with the latest updates

  • Installed CUDA Toolkit cuda_12.4.1_551.78_windows.exe

  • Installed cuDNN 9.0.0 for CUDA 12

Anaconda Environment configuration
conda create --name gpt_env python=3.7
conda activate gpt_env
pip install tensorflow
pip show tensorflow
pip install torch torchvision torchaudio --extra-index-url url is hidden as formum denied to publish more then 2 urls (pytorch/whl/cu121)
pip install transformers
conda install -c conda-forge jupyterlab
conda install -c conda-forge pandas
conda install -c conda-forge seaborn
conda install -c conda-forge matplotlib

conda install -c conda-forge jupyterlab_widgets  
conda install -c conda-forge yipywidgets 
conda install -c conda-forge scikit-learn

Issue
when I check if PyTorch is available in my Jupiter lab notebook i have False

print(torch.cuda.is_available()) ---> False

If I’m trying to install PyTorch as was suggested in topic above i have following error
(gpt_env2) PS C:\Users\NoName> pip install [url hidden]/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_amd64.whl
ERROR: torch-2.1.0.dev20230811+cu121-cp311-cp311-win_amd64.whl is not a supported wheel on this platform.

I have to mention that i have Intell based laptop with NVIDIA GPU, so i tried below, and doesn’t work as well
(gpt_env) PS C:\Users\NoName> pip install [url hidden]/whl/nightly/cu121/torch-2.1.0.dev20230811%2Bcu121-cp311-cp311-win_x86_64.whl
ERROR: torch-2.1.0.dev20230811+cu121-cp311-cp311-win_x86_64.whl is not a supported wheel on this platform.

Could you please help me resolve this issue and make PyTorch compiled to work use GPU in the first place

Appreciate your help in advance,
Best regards,
Maks.

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

thank you. so strange, pytorch-cuda 12.4 forces cpu…

1 Like