Error "Torch is not able to use GPU" when installing Stable Diffusion WebUI

I have a problem with Torch that occurs when installing AUTOMATIC1111’s Stable Diffusion WebUI.

The following error occurs every time: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check.

I have tried all the solutions I found on the web without success. My problem seems to be similar to this one. Unfortunately there is no problem with the CUDA_VISIBLE_DEVICES environment variable that could cause this behavior.

Further information:

  • Win10, GeForce GTX 1060
  • nvidia-smi gives 12.1
  • print(torch.version.cuda) returns 11.7
  • Executing python -c "import torch; print(torch.randn(1).cuda())" returns a blank line
  • Executing python -c "import torch; print(torch.cuda.is_available())" returns a blank line
  • Executing python -m torch.utils.collect_env throws this error:
    AttributeError: 'NoneType' object has no attribute 'splitlines'
  • This answer from reddit couldn’t fix my problem either

I really don’t know what else to try. Maybe one of you has some idea what is causing the problem?
Thanks in advance

Maybe you could try to install PyTorch manually using our install instructions in another virtual environment to check if it can detect and use your GPU. Once this is done you could check if the mention application could reuse your PyTorch installation instead of installing a new one.

1 Like

Installed torch in a new virtual enviroment as you suggested. Unfortunately the same thing happens again with torch.cuda.is_available():
It takes a moment and then an empty line is returned and python exits.

If the Python executable exits unexpectedly I would assume it crashes and you might want to debug it e.g. via gdb.