GPU is not available for Pytorch

Hi to everyone,
I probably have some some compatibility problem between the versions of CUDA and PyTorch.
I can’t use the GPU and everytime I ran the command torch.cuda.is_available() the result is always FALSE.

I’m using Anaconda (on Windows 11) and I have tried many things (such as upgrading and downgrading variuos versions), but nothing has worked.

I have a GeForce MX150 and currently my versions are:
CUDA Version: 11.6
PyTorch Version: 1.13.1
Python Version 3.9.13

Thank you all

I have the same GPU in my Windows laptop and the 1.3.1+cu117 wheels work fine for me:

>>> import torch
>>> torch.__version__
>>> torch.cuda.is_available()
>>> torch.cuda.get_device_properties(0)
_CudaDeviceProperties(name='GeForce MX150', major=6, minor=1, total_memory=2048MB, multi_processor_count=3)
>>> torch.randn(1).cuda()
tensor([-0.9126], device='cuda:0')

Thank you for your answer.
Unfortunatelly, there seams that the ‘1.13.1+cu117’ version doesn’t work with conda, but only with pip. Did you used pip or conda to install it?

Thank you again.

After many attempts I managed to get things working (I don’t know exactly how and why).

I report some passages here if they might be of use to someone.

1)Open anaconda prompt as administrator.

2)Remove everything:

conda remove pytorch torchvision torchaudio cudatoolkit
conda clean --all

3)Instal things separately and activating tensorflow-gpu:

conda install -c anaconda cudatoolkit
conda create -n tf-gpu tensorflow-gpu
conda activate tf-gpu

4)Instal PyTorch (GPU version compatible with CUDA verison):

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
1 Like

I’m having the same problem with 2.0.0 as mentioned above, however the torch==1.3.1+cu117 doesn’t seem to work anymore:

ERROR: Could not find a version that satisfies the requirement torch==1.3.1+cu117 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0)
ERROR: No matching distribution found for torch==1.3.1+cu117

1.3.1+cu117 isn’t a valid build and I assume you want to install 1.13.1+cu117.
In any case I would still recommend installing the latest stable release instead of trying to fall back.

Sorry, same error with 1.13.1+cu117:

ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0)
ERROR: No matching distribution found for torch==1.13.1+cu117

Installing 2.0.0&1.13.1 gives me AssertionError: Torch not compiled with CUDA enabled.
Previously, it couldn’t detect the CUDA of my RTX 2060. Spend two weeks on this.

Both versions work for me if I stick to the install instructions:

pip install torch
Collecting torch
  Downloading torch-2.0.0-cp38-cp38-manylinux1_x86_64.whl (619.9 MB)
pip install torch==1.13.1
Collecting torch==1.13.1
  Downloading torch-1.13.1-cp38-cp38-manylinux1_x86_64.whl (887.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 887.4/887.4 MB 58.5 MB/s eta 0:00:00
Collecting typing-extensions
  Downloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting nvidia-cudnn-cu11==
  Downloading nvidia_cudnn_cu11- (557.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 557.1/557.1 MB 58.4 MB/s eta 0:00:00
Collecting nvidia-cuda-runtime-cu11==11.7.99
  Downloading nvidia_cuda_runtime_cu11-11.7.99-py3-none-manylinux1_x86_64.whl (849 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 849.3/849.3 kB 79.3 MB/s eta 0:00:00
Collecting nvidia-cublas-cu11==
  Downloading nvidia_cublas_cu11- (317.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 317.1/317.1 MB 58.4 MB/s eta 0:00:00
Collecting nvidia-cuda-nvrtc-cu11==11.7.99
  Downloading nvidia_cuda_nvrtc_cu11-11.7.99-2-py3-none-manylinux1_x86_64.whl (21.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.0/21.0 MB 58.5 MB/s eta 0:00:00
pip install torch==1.13.1+cu117 --extra-index-url
Looking in indexes:,
Collecting torch==1.13.1+cu117
  Downloading (1801.8 MB)