PyTorch compiled from source for Windows is failing when importing torch

DTSED: <p>Hello, I am getting this error when compiling PyTorch from source for Windows 10.<br>
Since my GPU (GTX Titan Black) has compute capability version 3.5 and PyTorch current binaries are compatible with &gt;= 3.7 I guess I have to compile it from source for getting support for my device.<br>
I will try to describe the process I have followed:<br>
My environment:<br>
Windows 10<br>
Visual Studio 2017<br>
Anaconda3 2020.02 (Python 3.7.6 64-bit)<br>
CUDA 10.1 with cuDNN 7.6.5</p>
<p>I have followed the instruction from PyTorch github repository for compiling from source for Windows:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/pytorch/pytorch#from-source">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/pytorch/pytorch#from-source" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://opengraph.githubassets.com/fc45a83d9de2c5ba8471990ba45fbb79a753ec57e01ea665bf6a17f6c4e5a3ac/pytorch/pytorch" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/pytorch/pytorch#from-source" target="_blank" rel="noopener nofollow ugc">GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with...</a></h3>

  <p>Tensors and Dynamic neural networks in Python with strong GPU acceleration - GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration</p>


  </article>

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

  <div style="clear: both"></div>
</aside>
<p>
As I use Ninja for generating CMake, after clonning the repository I just launch:<br>
python setup.py install</p>
<p>It seems that all ends without error but when I check it in Python, after “import torch” I am getting this error:<br>
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32<br>
Type “help”, “copyright”, “credits” or “license” for more information.</p>
<blockquote>
<blockquote>
<blockquote>
<p>import torch<br>
Traceback (most recent call last):<br>
File “”, line 1, in <br>
File “C:\dev\anaconda\lib\site-packages\torch_<em>init</em>_.py”, line 76, in <br>
ctypes.CDLL(dll)<br>
File “C:\dev\anaconda\lib\ctypes_<em>init</em>_.py”, line 364, in <strong>init</strong><br>
self._handle = _dlopen(self._name, mode)<br>
OSError: [WinError 1114] A dynamic link library (DLL) initialization routine failed</p>
</blockquote>
</blockquote>
</blockquote>
<p>If I modify <strong>init</strong>.py manually at line 76 and add a print to the for loop for getting the dll names loading:<br>
for dll in dlls:<br>
print (dll)<br>
ctypes.CDLL(dll)</p>
<p>The output I get is:<br>
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32<br>
Type “help”, “copyright”, “credits” or “license” for more information.</p>
<blockquote>
<blockquote>
<blockquote>
<p>import torch<br>
C:\dev\anaconda\lib\site-packages\torch\lib\asmjit.dll<br>
C:\dev\anaconda\lib\site-packages\torch\lib\c10.dll<br>
C:\dev\anaconda\lib\site-packages\torch\lib\c10_cuda.dll<br>
C:\dev\anaconda\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll<br>
Traceback (most recent call last):<br>
File “”, line 1, in <br>
File “C:\dev\anaconda\lib\site-packages\torch_<em>init</em>_.py”, line 77, in <br>
ctypes.CDLL(dll)<br>
File “C:\dev\anaconda\lib\ctypes_<em>init</em>_.py”, line 364, in <strong>init</strong><br>
self._handle = _dlopen(self._name, mode)<br>
OSError: [WinError 1114] A dynamic link library (DLL) initialization routine failed</p>
</blockquote>
</blockquote>
</blockquote>
<p>Could anyone help me with this issue?<br>
Thanks in advance for your time and your attention.</p>
<p>Regards</p>

peterjc123: <p>Usually, it is because you have some conflicting DLLs in the system directory, including libiomp5md.dll.</p>

DTSED: <p><a class="mention" href="/u/peterjc123">@peterjc123</a> Thanks for your response. I am checking for libiomp5md.dll and it seems it is in intel-openmp package and $(anaconda_install)\Library\bin. I have uninstalled intel-openmp but the problem is still there.<br>
After your comment that some “conflicting DLLs…” I have checked the dependencies of the library that produces the error caffe2_detectron_ops_gpu.dll, and based on its output, I don´t see dependency with the openmp library and other dependencies exist as well. Is there a way that ctypes.CDLL shows which dll dependency fails? Or other solution that I could try?</p>
<p>Thanks again</p>

peterjc123: <p>Please capture the logs during <code>import torch</code> using <code>Process Monitor</code> and share with me.</p>

DTSED: <p>Ok, this is the complete log for the import torch process…</p>
<aside class="onebox googledrive" data-onebox-src="https://drive.google.com/file/d/1MnXfU9PrFx0jcKriJdp-TIslrFxzy9yI/view?usp=sharing">
  <header class="source">

      <a href="https://drive.google.com/file/d/1MnXfU9PrFx0jcKriJdp-TIslrFxzy9yI/view?usp=sharing" target="_blank" rel="noopener nofollow ugc">drive.google.com</a>
  </header>

  <article class="onebox-body">
      <a href="https://drive.google.com/file/d/1MnXfU9PrFx0jcKriJdp-TIslrFxzy9yI/view?usp=sharing" target="_blank" rel="noopener nofollow ugc"><span class="googledocs-onebox-logo g-drive-logo"></span></a>



<h3><a href="https://drive.google.com/file/d/1MnXfU9PrFx0jcKriJdp-TIslrFxzy9yI/view?usp=sharing" target="_blank" rel="noopener nofollow ugc">Logfile.CSV</a></h3>

<p>Google Drive file.</p>

  </article>

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

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

<p>Just before exiting the process, after loading “caffe2_detectron_ops_gpu.dll”, the invalid results are from … which I am not sure what problem could be…</p>
<blockquote>
<p>“8:31:43,7081797”,“python.exe”,“24076”,“QueryNormalizedNameInformationFile”,“C:\dev\anaconda\Lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll”,“SUCCESS”,“”<br>
“8:31:43,7094063”,“python.exe”,“24076”,“CreateFile”,“C:\Users\TestUser&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7097122”,“python.exe”,“24076”,“CreateFile”,“C:\Users\TestUser&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7098654”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\python37.zip&lt;stdin&gt;”,“PATH NOT FOUND”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7100966”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\DLLs&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7104754”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7108174”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7114373”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib\site-packages&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7116744”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib\site-packages\win32&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7119107”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib\site-packages\win32\lib&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7121061”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib\site-packages\pythonwin&lt;stdin&gt;”,“NAME INVALID”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a”<br>
“8:31:43,7123956”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“SUCCESS”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened”<br>
“8:31:43,7125289”,“python.exe”,“24076”,“QueryEAFile”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“SUCCESS”,“”<br>
“8:31:43,7221640”,“python.exe”,“24076”,“QueryInformationVolume”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“SUCCESS”,“VolumeCreationTime: 24/04/2019 21:45:47, VolumeSerialNumber: AA50-113C, SupportsObjects: True, VolumeLabel: "<br>
“8:31:43,7222032”,“python.exe”,“24076”,“QueryAllInformationFile”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“BUFFER OVERFLOW”,“CreationTime: 06/04/2020 15:29:55, LastAccessTime: 07/04/2020 9:12:01, LastWriteTime: 07/04/2020 9:12:01, ChangeTime: 07/04/2020 9:12:01, FileAttributes: A, AllocationSize: 16.384, EndOfFile: 13.409, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x2000000157d2f, EaSize: 0, Access: Generic Read, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Long”<br>
“8:31:43,7223340”,“python.exe”,“24076”,“ReadFile”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“SUCCESS”,“Offset: 0, Length: 4.096, Priority: Normal”<br>
“8:31:43,7225964”,“python.exe”,“24076”,“ReadFile”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“SUCCESS”,“Offset: 0, Length: 8.192”<br>
“8:31:43,7227418”,“python.exe”,“24076”,“CloseFile”,“C:\dev\anaconda\Lib\site-packages\torch_<em>init</em>_.py”,“SUCCESS”,”"<br>
“8:31:43,7230954”,“python.exe”,“24076”,“CreateFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,“Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened”<br>
“8:31:43,7232210”,“python.exe”,“24076”,“QueryEAFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,“”<br>
“8:31:43,7404920”,“python.exe”,“24076”,“QueryInformationVolume”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,“VolumeCreationTime: 24/04/2019 21:45:47, VolumeSerialNumber: AA50-113C, SupportsObjects: True, VolumeLabel: "<br>
“8:31:43,7405325”,“python.exe”,“24076”,“QueryAllInformationFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“BUFFER OVERFLOW”,“CreationTime: 06/04/2020 11:48:22, LastAccessTime: 06/04/2020 11:48:22, LastWriteTime: 18/12/2019 20:48:49, ChangeTime: 06/04/2020 11:48:55, FileAttributes: A, AllocationSize: 20.480, EndOfFile: 17.574, NumberOfLinks: 2, DeletePending: False, Directory: False, IndexNumber: 0x200000014f30c, EaSize: 0, Access: Generic Read, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Long”<br>
“8:31:43,7406588”,“python.exe”,“24076”,“ReadFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,“Offset: 0, Length: 4.096, Priority: Normal”<br>
“8:31:43,7407871”,“python.exe”,“24076”,“ReadFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,“Offset: 0, Length: 8.192”<br>
“8:31:43,7409187”,“python.exe”,“24076”,“ReadFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,“Offset: 8.192, Length: 8.192”<br>
“8:31:43,7410093”,“python.exe”,“24076”,“CloseFile”,“C:\dev\anaconda\Lib\ctypes_<em>init</em>_.py”,“SUCCESS”,”"<br>
“8:32:25,6834947”,“python.exe”,“24076”,“Thread Exit”,“”,“SUCCESS”,“Thread ID: 21572, User Time: 0.0000000, Kernel Time: 0.0156250”<br>
“8:32:25,6834965”,“python.exe”,“24076”,“Thread Exit”,“”,“SUCCESS”,“Thread ID: 1832, User Time: 0.0000000, Kernel Time: 0.0625000”<br>
“8:32:25,6835112”,“python.exe”,“24076”,“Thread Exit”,“”,“SUCCESS”,“Thread ID: 22704, User Time: 0.0000000, Kernel Time: 0.0625000”<br>
“8:33:09,6798533”,“python.exe”,“24076”,“Thread Exit”,“”,“SUCCESS”,“Thread ID: 776, User Time: 0.0000000, Kernel Time: 0.0000000”<br>
“8:33:09,6799656”,“python.exe”,“24076”,“Thread Exit”,“”,“SUCCESS”,“Thread ID: 20244, User Time: 0.0000000, Kernel Time: 0.0000000”</p>
</blockquote>

peterjc123: <p>The file you provided could not be downloaded. What’s more, I can hardly see anything because I couldn’t adjust the size of the column in that form.</p>

DTSED: <p>Sorry it seems the default option in my account did not allow downloads. Now you shoud be able to download it. Thanks and sorry for that</p>

peterjc123: <p>The following are the loaded DLLs:</p>
<pre><code class="lang-auto">C:\dev\anaconda\python3.dll
C:\dev\anaconda\python3.dll
C:\dev\anaconda\python3.dll
C:\Windows\System32\kernel32.dll
C:\Windows\System32\kernel32.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\asmjit.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\asmjit.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\asmjit.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\c10.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\c10.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\c10.dll
C:\dev\anaconda\msvcp140.dll
C:\dev\anaconda\msvcp140.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\c10_cuda.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\c10_cuda.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\c10_cuda.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll
C:\dev\anaconda\vcomp140.dll
C:\dev\anaconda\vcomp140.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cuda.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cpu.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cuda.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cpu.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cuda.dll
C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll
C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cusparse64_100.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cusparse64_100.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cpu.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\curand64_100.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\curand64_100.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudnn64_7.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudnn64_7.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\torch_cpu.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cufft64_100.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cufft64_100.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cublas64_100.dll
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cublas64_100.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\fbgemm.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\fbgemm.dll
C:\dev\anaconda\Lib\site-packages\torch\lib\fbgemm.dll
</code></pre>
<p>The interesting fact is that it tries to load the DLLs from CUDA 10.0 but you say that you are trying to build against CUDA 10.1. Maybe you can make sure you are not mixing the two versions of CUDA during build by executing the commands before build.</p>
<pre><code class="lang-auto">set CUDA_PATH=%CUDA_PATH_V10_1%
set "PATH=%CUDA_PATH%\bin;%CUDA_PATH%\libnvvp;%PATH%"
</code></pre>

DTSED: <p>Hi again, sorry for the delay.</p>
<p>I have re-built PyTorch making sure CUDA_PATH points to 10.1, but the problem is still there. I have checked the libraries loaded and now they come from CUDA\v10.1… I do not know where the problem comes from. Maybe I need to build disabling some features?<br>
Thanks again for your help</p>

peterjc123: <p>I guess the cause is somehow related to OpenMP. Would you please add MKL to build to verify my hypothesis? As for the installation script, you can refer to <a href="https://github.com/pytorch/builder/blob/master/windows/build_pytorch.bat#L68-L73" rel="nofollow noopener">https://github.com/pytorch/builder/blob/master/windows/build_pytorch.bat#L68-L73</a>.</p>
<p>Update:<br>
A fast way to do that verification is to run the following code before importing torch:</p>
<pre><code class="lang-auto">import ctypes
ctypes.CDLL(r"C:\Windows\System32\vcomp140.dll")
</code></pre>
<p>If this fixes your problem, then the DLL from Anaconda <code>C:\dev\anaconda\vcomp140.dll</code> may be incompatible.</p>

DTSED: <p>You were correct that somehow was related with OpenMP. I did not find which problem exactly was since I had installed MKL and built using it. However your suggestion of using “builder” git repository has been the solution for me.<br>
I have built it (pytorh .whl and libtorch package) using that repository (with settings env variables) and the result is good for me. I guess using setup.py, I were missing something that did not resolve the MKL dependency as it needs it. Now I have it with compute capabitly 3.5.</p>
<p>Thanks a lot for your time and your help</p>

Julien_Maille: <p>I have the very same error (OSError: [WinError 1114]) with the binary distributed in official windows pip nightlies. Any clue which dll is incompatible or missing?</p>

peterjc123: <p>Could you please attach the VS debugger and post the stacktrace and the loaded DLLs?</p>

Julien_Maille: <p>I’m working with pycharm and the official python binaries. How can I list the loaded dlls?</p>

peterjc123: <p>For the loaded DLLs, you could use the following code:</p>
<pre><code class="lang-auto">import psutil, os
p = psutil.Process( os.getpid() )
for dll in p.memory_maps():
  print(dll.path)
</code></pre>

Julien_Maille: <p>Ok I ran this</p>
<pre><code class="lang-auto">import psutil, os
p = psutil.Process( os.getpid() )
for dll in p.memory_maps():
  print(dll.path)

import torch
</code></pre>
<p>and got that</p>
<pre><code class="lang-auto">C:\Windows\System32\l_intl.nls
C:\Windows\System32\C_1252.NLS
C:\Windows\System32\C_850.NLS
C:\Windows\System32\locale.nls
C:\Windows\Globalization\Sorting\SortDefault.nls
C:\Program Files\WindowsApps\Microsoft.LanguageExperiencePackfr-FR_19611.1.1.0_neutral__8wekyb3d8bbwe\Windows\System32\fr-FR\KernelBase.dll.mui
C:\Program Files\WindowsApps\Microsoft.LanguageExperiencePackfr-FR_19611.1.1.0_neutral__8wekyb3d8bbwe\Windows\System32\fr-FR\kernel32.dll.mui
C:\Users\julie\AppData\Local\Programs\Python\Python37\python.exe
C:\Users\julie\AppData\Local\Programs\Python\Python37\python37.dll
C:\Windows\System32\pdh.dll
E:\venv\Lib\site-packages\psutil\_psutil_windows.cp37-win_amd64.pyd
C:\Users\julie\AppData\Local\Programs\Python\Python37\DLLs\_lzma.pyd
C:\Users\julie\AppData\Local\Programs\Python\Python37\DLLs\_bz2.pyd
C:\Users\julie\AppData\Local\Programs\Python\Python37\DLLs\_socket.pyd
C:\Users\julie\AppData\Local\Programs\Python\Python37\DLLs\select.pyd
C:\Windows\System32\version.dll
C:\Windows\System32\wtsapi32.dll
C:\Users\julie\AppData\Local\Programs\Python\Python37\vcruntime140.dll
C:\Users\julie\AppData\Local\Programs\Python\Python37\python3.dll
C:\Windows\System32\apphelp.dll
C:\Windows\System32\rsaenh.dll
C:\Windows\System32\IPHLPAPI.DLL
C:\Windows\System32\cryptbase.dll
C:\Windows\System32\cryptsp.dll
C:\Windows\System32\winsta.dll
C:\Windows\System32\umpdc.dll
C:\Windows\System32\powrprof.dll
C:\Windows\System32\bcrypt.dll
C:\Windows\System32\gdi32full.dll
C:\Windows\System32\win32u.dll
C:\Windows\System32\msvcp_win.dll
C:\Windows\System32\bcryptprimitives.dll
C:\Windows\System32\KernelBase.dll
C:\Windows\System32\ucrtbase.dll
C:\Windows\System32\psapi.dll
C:\Windows\System32\msvcrt.dll
C:\Windows\System32\kernel32.dll
C:\Windows\System32\gdi32.dll
C:\Windows\System32\ws2_32.dll
C:\Windows\System32\shlwapi.dll
C:\Windows\System32\user32.dll
C:\Windows\System32\imm32.dll
C:\Windows\System32\shell32.dll
C:\Windows\System32\rpcrt4.dll
C:\Windows\System32\sechost.dll
C:\Windows\System32\advapi32.dll
C:\Windows\System32\ntdll.dll
Traceback (most recent call last):
  File "E:\test.py", line 6, in &lt;module&gt;
    import torch
  File "E:\venv\lib\site-packages\torch\__init__.py", line 80, in &lt;module&gt;
    ctypes.CDLL(dll)
  File "C:\Users\julie\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 1114] Une routine d’initialisation d’une bibliothèque de liens dynamiques (DLL) a échoué

</code></pre>

peterjc123: <p>The probably reason is that you are using French which triggered some bug that is related to locale. Would you please build a RelWithDebInfo build of PyTorch and attach the JIT debugger of Visual Studio? If you couldn’t do that, I can help you to build it.</p>

Julien_Maille: <p>I don’t feel like setting up a c++ environment and recompiling torch with all dependencies. Is there a simpler way to narrow this down?</p>

peterjc123: <p>No, since this is a C++ problem and we don’t know where it is. So I guess you need to do that.</p>

Julien_Maille: <p>Ok, what’s the easiest way to compile it (without cuda, torchvision, etc?)</p>