OSError: [WinError 127] The specified program could not be found

michaellongge: <p>%matplotlib inline<br>
import os<br>
import torch<br>
import torchvision</p>
<hr>
<p>OSError                                   Traceback (most recent call last)<br>
 in <br>
1 get_ipython().run_line_magic(‘matplotlib’, ‘inline’)<br>
2 import os<br>
----&gt; 3 import torch<br>
4 import torchvision</p>
<p>D:\Anaconda3\lib\site-packages\torch_<em>init</em>_.py in <br>
122                 err = ctypes.WinError(last_error)<br>
123                 err.strerror += f’ Error loading “{dll}” or one of its dependencies.’<br>
 → 124                 raise err<br>
125             elif res is not None:<br>
126                 is_loaded = True</p>
<p>OSError: [WinError 127]  Error loading “D:\Anaconda3\lib\site-packages\torch\lib\c10_cuda.dll” or one of its dependencies.</p>

Saurabh_Sinha_2011: <p>Have you resolved this? I’m getting the same error.</p>

Cissucalris9: <p>If you are using torch Cuda 11.8, put cudart64_110 from cuda toolkit 11.4 inside torch/lib folder.</p><aside class="onebox githubissue" data-onebox-src="https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7379">
  <header class="source">

      <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7379" target="_blank" rel="noopener nofollow ugc">github.com/AUTOMATIC1111/stable-diffusion-webui</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7379" target="_blank" rel="noopener nofollow ugc">[Bug]: cudart64_110.dll shipped with PyTorch 1.13.1 fails to load on Windows 7</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2023-01-29" data-time="21:08:01" data-timezone="UTC">09:08PM - 29 Jan 23 UTC</span>
      </div>

        <div class="date">
          closed <span class="discourse-local-date" data-format="ll" data-date="2023-01-30" data-time="10:04:46" data-timezone="UTC">10:04AM - 30 Jan 23 UTC</span>
        </div>

      <div class="user">
        <a href="https://github.com/h3rmit-git" target="_blank" rel="noopener nofollow ugc">
          <img alt="h3rmit-git" src="https://avatars.githubusercontent.com/u/28364655?v=4" class="onebox-avatar-inline" width="20" height="20">
          h3rmit-git
        </a>
      </div>
    </div>

    <div class="labels">
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          asking-for-help-with-local-system-issues
        </span>
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">### Is there an existing issue for this?

- [X] I have searched the existing iss<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">ues and checked the recent builds/commits

### What happened?

I tried running stable-diffusion-webui on Windows 7, SP1, using the unofficial build of Python version 3.10.6 (PythonWin7).

The first time I run webui-user.bat, I get the following error:

`OSError: [WinError 126] Error loading "E:\stable-diffusion-webui\venv\lib\site-packages\torch\lib\cudart64_110.dll" or one of its dependencies.`

Screenshot:
![image](https://user-images.githubusercontent.com/28364655/215355694-79d1dce2-0a48-4384-8a6b-451b33b70107.png)

The cudart64_100.dll shipped with torch-1.13.1+cu117 seems to be incompatible with Windows 7.

- The last CUDA Toolkit released by Nvidia for Windows 7 is CUDA Toolkit 11.1.
- Stable-diffusion-webui currently uses PyTorch 1.13.1 compiled for CUDA 11.7.
- The Nvidia drivers 450.80.02+ for Windows 7 seem to be forward compatible with all versions of CUDA 11.x

Replacing the offending dll with the one from the CUDA Toolkit 11.1 for Windows 7, in the following locations seems to resolve the issue:
- .\venv\Lib\site-packages\torchvision
- .\venv\Lib\site-packages\torch\lib

 So far I have generated thousands of images without encountering any errors or experiencing any speed degradations.

### Steps to reproduce the problem

Just run webui-user.bat on Windows 7 for the first time, and you will get an error similar to the following:

OSError: [WinError 126] Error loading "E:\stable-diffusion-webui\venv\lib\site-packages\torch\lib\cudart64_110.dll" or one of its dependencies.


### What should have happened?

The Nvidia drivers 450.80.02+ for Windows 7 seem to be forward compatible with all versions of CUDA 11.x, so please add a workaround to at least allow Windows 7 users to use cudart64_110.dll from CUDA 11.1 (last released CUDA Toolkit for Windows 7).

### Commit where the problem happens

7ff1ef77dd22f7b38612f91b389237a5dbef2474

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

Windows

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

Google Chrome

### Command Line Arguments

```Shell
No
```


### List of extensions

No

### Console logs

```Shell
OSError: [WinError 126] Error loading "E:\stable-diffusion-webui\venv\lib\site-packages\torch\lib\cudart64_110.dll" or one of its dependencies.
```


### Additional information

_No response_</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>