On a Windows 10 PC with an NVidia GeForce 820M I installed CUDA 9.2 and cudnn 7.1 successfully, and then installed PyTorch using the instructions at pytorch.org.
Specifically I used the command
pip install torch==1.4.0+cu92 torchvision==0.5.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html
because i use pip and not Anaconda.
Yet I get the following
>>> import torch
>>> torch.cuda.is_available()
False
Why is this happening?
To solve this issue, the following method answered for me:
1- First you have to update Anaconda.
2- In your notebook, select the following based on your system.
https://pytorch.org/
example for Windows:(This may take some time. Be patient)
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
3- Find and install the latest graphics card for your system through the following site:
https://www.nvidia.com/Download/index.aspx
4- Supported CUDA level of GPU and card. see this
I want to share also my experience, especially in the WSL2 environment. See my post here.
Despite I had installed the correct and latest drivers following the guide provided by NVidia here, my WSL was not able to detect any GPU both in PyTorch and in the whole environment.
My GPU is Nvidia GeForce RTX 1650 Ti, which is not listed in the Wiki link above but is actually shown in the NVidia page.
Downgrading to an older driver version found at this NVidia link, namely Driver Version: 472.39 helped me out. Now PyTorch can correctly detect the driver, as well as I can run containers that require GPU access since it is correctly found and used.
Hoping this will help someone in my situation.
ok here's my experience my system is ubuntu 20.4, gpu - nvidi gtx 1060
when i go and change run the 'Nvidia X Server Settings' application i found under the PRIME Profiles Nvidia On-Demand or Inter(power saving mode) is selected
giving torch.cuda.is_available() to False
i changed the GPU Mode to 'NVIDIA(Performance Mode) then i got True
The same error can appear when the version of your Pytorch supports different CUDA. For example, my Pytorch version was with CUDA 8.0 support, but I had CUDA 9.0 installed. To fix that I had to upgrade my Pytorch to cu90 like this:
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu90/torch_nightly.html
Reference: here