1

I have torch installed in a conda environment. When I run python in command line and try to check CUDA availability I get False as show below.

>>> import torch
>>> torch.cuda.is_available()
False

However, when I use jupyter notebook, it shows CUDA is available. I'm using the same environment. The GPU is on the same local Windows machine

import torch
torch.cuda.is_available()
> True
!which python
> /c/Users/b2bt/anaconda3/envs/stable-diffusion/python

I tried creating a new conda environment to run the stable diffusion web UI. I've installed torch previously in a different environment and have used it successfully with GPU. I was expecting the terminal to show CUDA available but strangely it doesn't.

0

2 Answers 2

2

This problem may be caused by using pip install pytorch to install package.

Solution:

Open the official website, and search for the correct version for your environment.

enter image description here

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
Sign up to request clarification or add additional context in comments.

2 Comments

I never got to try this solution but thanks for answering. Previously I was using the .bat file to install everything which was provided in the repository. But then I tried installing everything manually and it worked.
Thanks! I used pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117 and it worked for me.
2

I had the same issue as you have. I realized pytorch was not installed.

So, installed in using pip3 command stated above:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.