AssertionError: Torch not compiled with CUDA enabled (depite several reinstallations)

Viewed 8560

Whenever I try to move a variable to cuda in pytorch (e.g. torch.zeros(1).cuda(), I get the error message "AssertionError: Torch not compiled with CUDA enabled". Besides,torch.cuda.is_available() returns False.

I have read several answers to approaching this error but for some reason several attempts to reinstall cuda and putorch didn't change anything. Here are some of the settings I used:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

conda install pytorch torchvision cudatoolkit=11 -c pytorch-nightly

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch

Yet the same error remains. What could be the issue?

Some settings: I'm using Ubuntu 20.04, GPU is RTX 2080, nvidia-smi works fine (NVIDIA-SMI 460.91.03, Driver Version: 460.91.03, (max possible) CUDA Version: 11.2)

1 Answers

Try installing with pip pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

You can go through this thread for detailed explanations Pytorch for cuda 11.2

Related