Repository: stable-diffusion-webui
Issue: [Bug]:  Torch is not able to use GPU with current NVIDIA driver on fresh windows
Labels: bug-report

### Checklist

- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [X] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

A fresh automatic 1111 installation on an fresh windows & python installation results in:
```

venv "C:\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.3
Commit hash: 1c0a0c4c26f78c32095ebc7f8af82f5c04fca8c0
Traceback (most recent call last):
  File "C:\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "C:\stable-diffusion-webui\launch.py", line 39, in main
    prepare_environment()
  File "C:\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
```

Non of the informations provided here (https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting)  could solve that problem.

### Steps to reproduce the problem

1. Acting as standard-"user"
2.  I have a fresh Windows 11 pro installation, with current Nvidia Drivers 552.22 (running on card RTX4050).
3. I installed python 3.10.6 as recomended and installed git.
4. I did a git clone from current a1111 release and double-clicked the `webui-user.bat`, which downloaded a bundle of python-packages.  (see section `Console logs`)
5. The first startup ends with `RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check`

### What should have happened?

WebUI should start up using the Nvidia GPU (which is GPU device 1)

### What browsers do you use to access the UI ?

Mozilla Firefox

### Sysinfo

I cant start the WebUI.  
Follwoing `If you can't start WebUI, you can use --dump-sysinfo commandline argument to generate the file.` results in: 
```

venv "C:\stable-diffusion-webui\venv\Scripts\Python.exe"
Traceback (most recent call last):
  File "C:\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "C:\stable-diffusion-webui\launch.py", line 29, in main
    filename = launch_utils.dump_sysinfo()
  File "C:\stable-diffusion-webui\modules\launch_utils.py", line 473, in dump_sysinfo
    from modules import sysinfo
  File "C:\stable-diffusion-webui\modules\sysinfo.py", line 8, in <module>
    import psutil
ModuleNotFoundError: No module named 'psutil'
```

### Console logs

```Shell
First startup:
=============

Creating venv in directory C:\stable-diffusion-webui\venv using python "C:\Program Files\Python310\python.exe"
venv "C:\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.3
Commit hash: 1c0a0c4c26f78c32095ebc7f8af82f5c04fca8c0
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121
Collecting torch==2.1.2
  Downloading https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp310-cp310-win_amd64.whl (2473.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 GB 1.6 MB/s eta 0:00:00
Collecting torchvision==0.16.2
  Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.2%2Bcu121-cp310-cp310-win_amd64.whl (5.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 12.4 MB/s eta 0:00:00
Collecting networkx
  Downloading networkx-3.3-py3-none-any.whl (1.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 6.8 MB/s eta 0:00:00
Collecting fsspec
  Downloading fsspec-2024.3.1-py3-none-any.whl (171 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.0/172.0 kB 5.1 MB/s eta 0:00:00
Collecting filelock
  Downloading filelock-3.14.0-py3-none-any.whl (12 kB)
Collecting jinja2
  Downloading jinja2-3.1.4-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 kB ? eta 0:00:00
Collecting typing-extensions
  Downloading typing_extensions-4.11.0-py3-none-any.whl (34 kB)
Collecting sympy
  Downloading https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl (5.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 13.1 MB/s eta 0:00:00
Collecting pillow!=8.3.*,>=5.3.0
  Downloading pillow-10.3.0-cp310-cp310-win_amd64.whl (2.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 12.4 MB/s eta 0:00:00
Collecting requests
  Downloading requests-2.31.0-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB ? eta 0:00:00
Collecting numpy
  Downloading numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.8/15.8 MB 12.4 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
  Downloading https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl (17 kB)
Collecting urllib3<3,>=1.21.1
  Downloading urllib3-2.2.1-py3-none-any.whl (121 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.1/121.1 kB ? eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading certifi-2024.2.2-py3-none-any.whl (163 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8/163.8 kB 10.2 MB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading idna-3.7-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.8/66.8 kB ? eta 0:00:00
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.3/100.3 kB ? eta 0:00:00
Collecting mpmath>=0.19
  Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 17.0 MB/s eta 0:00:00
Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, fsspec, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision
Successfully installed MarkupSafe-2.1.5 certifi-2024.2.2 charset-normalizer-3.3.2 filelock-3.14.0 fsspec-2024.3.1 idna-3.7 jinja2-3.1.4 mpmath-1.3.0 networkx-3.3 numpy-1.26.4 pillow-10.3.0 requests-2.31.0 sympy-1.12 torch-2.1.2+cu121 torchvision-0.16.2+cu121 typing-extensions-4.11.0 urllib3-2.2.1

[notice] A new release of pip available: 22.2.1 -> 24.0
[notice] To update, run: C:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip
Traceback (most recent call last):
  File "C:\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "C:\stable-diffusion-webui\launch.py", line 39, in main
    prepare_environment()
  File "C:\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
```


### Additional information

All drivers are recently updated. I triede differen HowTos found on the web, like adding different COMMANDLINE_ARGS in the webui-user.sh,  but no ones fixed the problem.

I tried all the stuff provided here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Troubleshooting
like this:  

```
1.     Open the console under venv\Scripts
2.     Run python -m torch.utils.collect_env
3.     Copy all the output of the console and post it
```

This results to the following output:  

.\python.exe -m torch.utils.collett_env
Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
                 It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Program Files\Python310\lib\runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "C:\stable-diffusion-webui\venv\lib\site-packages\torch\__init__.py", line 139, in <module>
    raise err
OSError: [WinError 126] Unable to find this modul. Error loading "C:\stable-diffusion-webui\venv\lib\site-packages\torch\lib\c10.dll" or one of its dependencies.


So I had the following questions:

1. Is Microsoft Visual C++ Redistributable needed for automatic 1111? Because it's not mentioned in the requirements. Btw: Installing from https://aka.ms/vs/16/release/vc_redist.x64.exe did **not** fix the problem.
2. Do I have to install Cuda 12.1 or 12.4 from Nvidia or should I have to do somethink like ` pip install cuda-python`?
3. The current driver comes with cuda 12.4, but automatic1111 installs torch für cuda 12.1. Is the driver downward compatible? SO that current 12.4 can work with torch 2.x+cu121?