PyTorch (GPU) not working on Win 11 box
tomvaiuw opened this issue · 4 comments
Hi,
I am trying to get Casanovo running on a Windows 11 box with GEForce RTX 3070 and following the instructions I could not get it work. I have Casanovo running but without using the GPU.
I first tried to install it several ways (mostly probably wrong), installing NVIDIA driver directly from NVIDIA website. Not sure if I got all appropriate drivers installed. But I believe I did. Then tried following the instruction in Casanovo FAQ page, uninstalling torch, then following installation as described on Pytorch website (and using the conda command it provided), still Casanovo would not see GPU.
Then I tried the >conda install -c nvidia cuda-toolkit and got error at the very end:
C:\Windows\System32>CALL C:\ProgramData\Anaconda3\etc\conda\activate.d\vs2017_get_vsinstall_dir.bat
Did not find VSINSTALLDIR
File Not Found
Windows SDK version found as: ""
The system cannot find the path specified.
Did not find VSINSTALLDIR
C:\Windows\System32>if defined INCLUDE (set "INCLUDE_CONDA_NVCC_BACKUP=" )
C:\Windows\System32>set "INCLUDE=;\targets\x64"
(base) C:\Windows\System32>
Any suggestion and advice would be greatly appreciated.
Thanks,
Tomas Vaisar
Hi Tomas,
Could you try opening a terminal window and running the command nvidia-smi
? This should tell you if CUDA is installed, and if it is installed what version is installed. The output should look something like this:
You should see the CUDA version in the top right corner of the output. Sometimes if there's a mismatch between the CUDA version specified in the PyTorch installation and the actual CUDA version installed on your system PyTorch won't be able to find your GPU.
As far as the specific error message your seeing, it looks like the error originates from a package that simply locates the installation directory of vscode. You might find some answers about resolving this specific error message here: https://stackoverflow.com/questions/68780561/long-error-messages-about-vsinstalldir-and-vs2019-whenever-i-start-anaconda-prom
A specific version of Visual Studio is not required, nor is Visual Studio required at all actually. It looks like something went wrong when installing one of the dependencies for nvidia cuda-toolkit
, which AFIK is not required to be installed explicitly in order to use Casanovo with a GPU.
In order to get a better understanding of what's going on, try opening a new terminal window and activating the Casanovo conda environment with conda activate casanovo_env
. Then, start an interactive python session by typing the command python
. Inside of the interactive python session, first import Pytorch with import torch
, and then check to see if PyTorch can see the GPU by typing torch.cuda.is_available()
. This should output true. The entire process should look something like this:
If you see False instead of True for the output of torch.cuda.is_available()
, try reinstalling PyTorch with:
pip3 install torch torchvision torchaudio --force-reinstall --index-url https://download.pytorch.org/whl/cu121
The --force-reinstall
will ensure that the correct PyTorch build that supports CUDA 12.5 is installed.