AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
140.57k stars 26.6k forks source link

[Bug]: Missing requirement for VC_redist.x64.exe causes "RuntimeError: Torch is not able to use GPU" #16032

Open nathanielhudson opened 3 months ago

nathanielhudson commented 3 months ago

Checklist

What happened?

On a clean windows installation with a Nvidia GPU when I try to follow the installation requirements I find that I encounter the "RuntimeError: Torch is not able to use GPU" error despite meeting all the requirements. I have found that the solution is to install VC_redist.x64.exe, which is not installed by default (although many/most users will already have it installed).

Steps to reproduce the problem

  1. Clean install windows
  2. Install python3, git, nvidia drivers
  3. Attempt either of the two install methods (manual or automatic)

You might also be able to reproduce this problem by uninstalling VC_redist.x64.exe and attempting to launch the web UI.

What should have happened?

I believe the Windows requirements should include Visual C++ Redistributable, https://download.visualstudio.microsoft.com/download/pr/9613cb5b-2786-49cd-8d90-73abd90aa50a/CEE28F29F904524B7F645BCEC3DFDFE38F8269B001144CD909F5D9232890D33B/VC_redist.x64.exe

What browsers do you use to access the UI ?

No response

Sysinfo

Here is a sysinfo file from the web UI after installing VC_redist.x64.exe: sysinfo_working.json

Console logs

venv "C:\XXXXXXXXXX\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.9.4
Commit hash: feee37d75f1b168768014e4634dcb156ee649c05
Traceback (most recent call last):
  File "C:\XXXXXXXXXX\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "C:\XXXXXXXXXX\stable-diffusion-webui\launch.py", line 39, in main
    prepare_environment()
  File "C:\XXXXXXXXXX\stable-diffusion-webui\modules\launch_utils.py", line 386, in prepare_environment
    raise RuntimeError(
RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
Press any key to continue . . .

Additional information

No response

frontboat commented 3 months ago

This fix worked for me on my AMD GPU (Radeon RX 6900 XT). Thank you.

My steps:

Thanks again, I wouldn't have figured this out otherwise.