Cannot import torch on windows (dll problem)

Chenoille: <p>Hello,<br>
I am trying to install Pytorch from source (with CUDA). While the compilation was successful, I am having issues with importing torch on windows 10 (using an “old” GPU Quadro K5200). It prints the following error:</p>
<pre><code class="lang-auto">import torch
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "C:\Installations\Pytorch\torch\__init__.py", line 139, in &lt;module&gt;
    raise err
OSError: [WinError 1114] Une routine d’initialisation d’une bibliothèque de liens dynamiques (DLL) a échoué. Error loading "C:\Installations\Pytorch\torch\lib\backend_with_compiler.dll" or one of its dependencies.
</code></pre>
<p>So, it appears to have a problem getting backend_with_compiler.dll or one of its dependencies.<br>
Therefore, I was redirected to <a href="https://github.com/peterjc123/pytorch_dll_load_smoketests" rel="noopener nofollow ugc">this website</a> and I tried the command you provided. Gflags stops after trying to import the C:\WINDOWS\SYSTEM32\symsrv.dll, which is not on my machine. The last output lines are:</p>
<pre><code class="lang-auto">080c:3604 @ 276919921 - LdrLoadDll - ENTER: DLL name: C:\WINDOWS\SYSTEM32\symsrv.dll
080c:3604 @ 276919921 - LdrpLoadDllInternal - ENTER: DLL name: C:\WINDOWS\SYSTEM32\symsrv.dll
080c:3604 @ 276919921 - LdrpFindKnownDll - ENTER: DLL name: symsrv.dll
080c:3604 @ 276919921 - LdrpFindKnownDll - RETURN: Status: 0xc0000135
080c:3604 @ 276919921 - LdrpResolveDllName - ENTER: DLL name: C:\WINDOWS\SYSTEM32\symsrv.dll
080c:3604 @ 276919921 - LdrpResolveDllName - RETURN: Status: 0xc0000135
080c:3604 @ 276919921 - LdrpProcessWork - ERROR: Unable to load DLL: "C:\WINDOWS\SYSTEM32\symsrv.dll", Parent Module: "(null)", Status: 0xc0000135
080c:3604 @ 276919921 - LdrpLoadDllInternal - RETURN: Status: 0xc0000135
080c:3604 @ 276919921 - LdrLoadDll - RETURN: Status: 0xc0000135
(80c.3604): C++ EH exception - code e06d7363 (first chance)
080c:3604 @ 276920234 - LdrpGetProcedureAddress - INFO: Locating procedure "FlsGetValue" by name
(80c.3604): C++ EH exception - code e06d7363 (first chance)
(80c.3604): C++ EH exception - code e06d7363 (!!! second chance !!!)
quit:
</code></pre>
<p>What should I do to resolve this? Should I simply add it to the System32 folder? Or do I understand this wrongly?</p>
<p>I do not face this issue when installing pytorch (cpu only) via pip. But I want to have Pytorch with cuda.</p>
<p>I thank you in advance for your help</p>

andreigh: <p>That error is misleading a bit, it should load even without symsrv.dll</p>
<p>Do you have visual studio ? If so:</p>
<ul>
<li>run the gflags command as described in <a href="https://github.com/peterjc123/pytorch_dll_load_smoketests" class="inline-onebox" rel="noopener nofollow ugc">GitHub - peterjc123/pytorch_dll_load_smoketests: Dll load smoketests for PyTorch on Windows</a></li>
<li>run python.exe in console in the pytorch directory, leave it running</li>
<li>open Visual Studio as Administrator and Attach Process to the running python.exe</li>
<li>go to the running python.exe console, input “import torch” to let the DLL error show</li>
<li>in Visual Studio continue debugging, and check the Output Console, you’ll see there the real DLL loading issues</li>
</ul>