1

I try to run my code with pytorch 10.2, but I get the assertion error described in the title. At first I installed cuda with version 11. Then I uninstalled it and installed version 10.2. Also, I used pytorch before without cuda and installed it using command: "conda install pytorch torchvision cpuonly -c pytorch"

Today after installing Cuda, I ran "conda install pytorch torchvision cudatoolkit=10.2 -c pytorch"

However, when I run command: "torch.cuda.is_available()", the output is False.

After running "nvcc --version" I can see that Cuda 10.2 is installed: "Cuda compilation tools, release 10.2, V10.2.89". Any idea how to fix this assertion error?

Other answers describe that I should install pytorch with cuda, but I already did that and I still get the same error. Do I need to enable cuda with pytorch somehow manually?

talonmies
  • 70,661
  • 34
  • 192
  • 269
MichiganMagician
  • 273
  • 2
  • 15
  • I have now received the CUDA tag twice from this question, because it is about PyTorch. There is no CUDA programming related content here. Please do not re-add it. – talonmies Jul 24 '20 at 16:00
  • What type of GPU do you have? Also, your system's cuda is not used by pytorch. The conda and pip pytorch packages are delivered with their own cuda binaries and ignore the system installation of cuda. The error indicates that the pytorch binaries were not compiled against cuda. The first thing I would try is uninstalling pytorch and installing again. – jodag Jul 24 '20 at 16:46
  • Hi, I have NVIDIA GTX 1070. I have tried uninstalling pytorch in my virtual environment and installing again, but after this line: torch.cuda.current_device(), I get the same error: Torch not compiled with CUDA enabled ~\Anaconda3\envs\shelfnow\lib\site-packages\torch\cuda\__init__.py in _check_driver() 45 def _check_driver(): 46 if not hasattr(torch._C, '_cuda_isDriverSufficient'): ---> 47 raise AssertionError("Torch not compiled with CUDA enabled") 48 if not torch._C._cuda_isDriverSufficient(): 49 if torch._C._cuda_getDriverVersion() == 0: – MichiganMagician Jul 25 '20 at 07:25
  • 1
    What I noticed is that nvcc --version gives cuda as 10.2, but nvidia-smi.exe gives version of 11. I guess I need to uninstall cuda 11 somehow differently. – MichiganMagician Jul 25 '20 at 07:46
  • Did you end up fixing this issue? – Nikita Belooussov Jun 05 '21 at 03:22
  • 1
    @NikitaBelooussov Probably it is too late, but what worked for me is to uninstall cuda, update nvidia drivers and then install cuda again. – MichiganMagician Jul 08 '21 at 12:30

0 Answers0