user....
user....

Reputation: 71

After installing Pytorch cuda , torch.cuda.is_available() show false. What to do?

I have installed pytorch cuda by running this command:

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

My cuda version is 11.2 . I am using windows 10 . Pytorch cuda 11.2 is not available right now . (pytorch.org)

So I have install 11.1 version .

(using nvidia-smi) Cuda version

But it show false.

torch.cuda.is_available() >>> False

I have tried both 10.2 and 11.1 version.

As far as I know, I do not need to install cuda toolkit for pytorch

Upvotes: 2

Views: 7503

Answers (1)

Prayson W. Daniel
Prayson W. Daniel

Reputation: 15558

You should not install package to your base environment. Create a separate environment with necessary tools.

Example: create env called dlearn with Python v3.7 and torch packages

conda create -n dlearn python=3.7 pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia

Activate and use your dlearn environment

conda activate dlearn
python -c "import torch;print(torch.cuda.is_available())"
# this should echo True if all is well

At the moment the supported cudatoolkit is 11.1 which works fine with 11.2 driver. They will update it sooner or later. You can build from GitHub PyTorch to get the latest if you want. The steps are more complex than above.

Upvotes: 2

Related Questions