Torch CUDA is not available

I was confused by the same problem. You are a life-saver Jason.

Worked perfectly for me as well! Thanks a lot @Jason_Tan

When i run torch.cuda.is_available()
False
when i run
torch.backends.cudnn.is_available()
torch.backends.cudnn.version()
i get
=> True
=> 90100
and for nvcc --version
i get

(base) [hager.saleh@janus.kmn.ie@hpc-hn-101 ~]$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

my os is Redhat Entriprise which is a node on an HPC that work with Slurm I didn’t get why cuda is not available on my user
I had to run module load cuda12.2/toolkit/12.2.2 to be availble on my PATH
I tried 2 env each one with both pip and conda and cuda12.1 but cuda is not working any help!