Windows 10 can't import torch

installed latest python 3.5.4, didn’t work as below, so uninstalled and tried 3.5.1 with same result. Same thing happened on my laptop, both with windows 10.

python-3.5.4-amd64
python-3.5.1-amd64
numpy-1.11.0-cp35-none-win_amd64.whl
matplotlib-1.5.1-cp35-none-win_amd64.whl
pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp35-cp35m-win_amd64.whl

python

import numpy
import matplotlib
import torch
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\agoodwin\AppData\Local\Programs\Python\Python35\lib\site-packages\torch_init_.py”, line 78, in
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.

1 Like

found a solution posted elsewhere.


@AlbertHuyb You are using pure Python, right? Then you’ll need to install the VC Redist 2017 by yourself. You’ll also need the intel-openmp dlls and Numpy.
Here are the links to them:
VC 2017 - https://aka.ms/vs/15/release/VC_redist.x64.exe
Intel openmp - https://anaconda.org/anaconda/intel-openmp/files

Download win-64/intel-openmp-2018.0.0-8.tar.bz2 and put the dll files in Library\bin into a dir and append the path of it to the environment variable PATH.

Just unack openmp to some directory, go to control panel - system - advanced - environment variables - select path - new - add a path to the bin folder of openmp

I had to install python 3.5.4 after a reboot, before it finally worked. So I had python 3.5.1, added the above, then rebooted, then upgraded to 3.5.4. This worked on both computers. Watch out for a pending windows update. Your Visual C++ redistribution install will just hang. Arg!

1 Like