Previously, I could run pytorch without problem. After installing a new version (older version) of CUDA, I got following error, and cannot resume this.
UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
  warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')

I use Windows 11 with WSL 2.
My GPU is GeForce RTX 3080 and CUDA Version is 11.6 (that was installed at the beginning in the factory of the PC). nvidia-smi result is as below.
±----------------------------------------------------------------------------+
| NVIDIA-SMI 495.29.05    Driver Version: 510.06       CUDA Version: 11.6     |
|-------------------------------±---------------------±---------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce …  On   | 00000000:01:00.0  On |                  N/A |
| N/A   61C    P8    23W /  N/A |    538MiB / 16384MiB |     N/A      Default |
|                               |                      |                  N/A |
±------------------------------±---------------------±---------------------+
±----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
±----------------------------------------------------------------------------+
I installed Pytorch (for CUDA 11.3) from the official site using following command.
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio===0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html 8
This worked without no problem, though my CUDA version is 11.6 and Pytorch is for CUDA 11.3

After a while, I installed an older version of CUDA (11.5), since I wanted to use CuPy and the latest version of CUDA that CuPY supports is 11.5.
I have downloaded CUDA from following link and installed. CUDA Toolkit 11.5 Downloads | NVIDIA Developer 9
As a result, I have been able to use CuPy as expected, but not run Pytorch with GPU. When I run pytorch, I got following error, and CPU runs instead.
UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
  warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')

“torch.cuda.is_available()” returned False.
Though I had installed CUDA11.5, nvidia-smi still showed CUDA 11.6, while nvcc --version showed CUDA 11.5

Seeing the situation, I have uninstalled CUDA11.5, using “App & Features” function of Windows GUI. I have uninstalled and reinstalled Pytorch.
However, the situations above have still continue.

GPU cannot be used by torch with error “CUDA is not available. Disabling”
torch.cuda.is_available() → False
Strangely, CuPy can be still used
(“nvcc” is uninstalled and cannot be used. )


I have tried for a while and no idea for now. Hope someone can provide me a hint.