1

I have a cuda-capable gpu in my computer, and the version is NVIDIA GeForce GTX 1660 Ti. The operating system is Windows10. According to the official website

https://pytorch.org/get-started/locally/

I opened anaconda prompt(anaconda 3) and entered the following line for installing pytorch

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

but when I enter this code in pycharm:

import torch
print(torch.cuda.is_available())

It returns False and this error appears:

UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at  ..\c10\cuda\CUDAFunctions.cpp:115.)
  return torch._C._cuda_getDeviceCount() > 0

Why is it like this? Doesn't this command

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

by default try to install cuda version if i have a cuda-capable gpu?

This is the output of nvidia-smi

enter image description here

  • What cuda version do you have installed? Run `nvcc --version` in a cmd prompt to get your currently installed version – NMme Aug 21 '21 at 09:20
  • It says nvcc is not recognized as an internal or external command, operable program or batch file. – NaturalQuestioner Aug 21 '21 at 09:25
  • Maybe you might not have the right nvidia-driver installed to work with the specified cuda version. What is your output when you run `nvidia-smi` in a cmd prompt? See [here](https://stackoverflow.com/questions/60272028/how-does-anaconda-pick-cudatoolkit) for more information on how anacondas cudatoolkit package and drivers are connected. – NMme Aug 21 '21 at 09:38
  • I've edited the post and added the ouput of nvidia-smi. – NaturalQuestioner Aug 21 '21 at 10:41
  • Do I need to install CUDA Toolkit 11.4 from here? https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local because the command I used in anaconda prompt for installing pytorch had cudatoolkit=11.1 – NaturalQuestioner Aug 21 '21 at 10:41
  • 2
    From the output you can see, that your current driver only supports up to cuda version 10.0 . You can either install the right cudatoolkit version in your anaconda environment `conda install cudatoolkit=10.0` or upgrade the driver for newer version. You can get the newest driver for your graphics card [here](https://www.nvidia.com/Download/index.aspx) . I dont think installing the CUDA Toolkit is necessary, the conda package will take care of that. – NMme Aug 21 '21 at 11:14
  • Will the command conda install cudatoolkit=10.0 rewrite the previous version by itself? or should I enter other commands so that the base environment forgets the 11.1 version and considers the 10.0 version? – NaturalQuestioner Aug 21 '21 at 13:43
  • I am not sure how anaconda handles reinstalling packages with a different version, so maybe the safest way to go is to uninstall the current cudatoolkit by running `conda remove cudatoolkit` in your environment and then reinstalling with the new version – NMme Aug 21 '21 at 20:37
  • Thanks. I also have some environment activation problems that I have posted here https://stackoverflow.com/questions/68873770/pytorch-not-appearing-in-the-kernel-of-jupyter-notebook – NaturalQuestioner Aug 22 '21 at 04:25
  • The `conda install cudatoolkit=10.0` will replace any existing versions in the env - you do not need to do any remove steps. – merv Aug 22 '21 at 17:10

0 Answers0