Skip to content

Instantly share code, notes, and snippets.

@peterjc123
Last active May 12, 2020 19:44
Show Gist options
  • Save peterjc123/6b804651288e76db7b5fabe5348e1f03 to your computer and use it in GitHub Desktop.
Save peterjc123/6b804651288e76db7b5fabe5348e1f03 to your computer and use it in GitHub Desktop.
For #4518 from torch._C import * (ImportError: DLL load failed: The specified module could not be found

It was caused by the missing of some of the dependencies: mkl, mkl-fft, intel-openmp and VC 2017 Redist.

For conda packages:

conda install mkl mkl-fft intel-openmp numpy
# If package not found, do this
conda update conda

For wheel packages:

pip install mkl mkl-fft intel-openmp numpy

And then download VC 2017 Redist and install it.

A reboot may be required for the libraries to take effect.

If this persists, it may be related to your environmental variables, such as PATH. Make sure it is not broken and at least point to the following locations:

[PythonRoot]
[PythonRoot]\Library\bin
[PythonRoot]\Scripts
[PythonRoot]\bin
%SYSTEMROOT%

P.S: #7579 ImportError: DLL load failed: The operating system cannot run %1. does not seem to be the same issue with this. It is related to Anaconda. Fix command: conda install -c defaults intel-openmp -f. If you want to help us, please provide us the logs with python -v -c 'import torch' and the result of the following code:

# pip install psutil first
import psutil, os
p = psutil.Process( os.getpid() )
for dll in p.memory_maps():
  print(dll.path)
@peterjc123
Copy link
Author

Guys, don't ask here. Ask in pytorch/pytorch. I cannot get notifications for this thread.

@Abeni18
Copy link

Abeni18 commented Aug 29, 2018

After a long search i found the solution
The problem is that if the GPU is old the pytorch version before 0.4.0 doesn’t work, so you have to install the newest pytorch,
run this - conda install -c pytorch pytorch
After you install the newest pytorch you will face torch._C import * DLL load failed problem
to fix that run the ff code
set PYTORCH_BUILD_VERSION=0.4.1

@Abeni18
Copy link

Abeni18 commented Aug 29, 2018

After a long search i found the solution
The problem is that if the GPU is old the pytorch version before 0.4.0 doesn’t work, so you have to install the newest pytorch,
run this - conda install -c pytorch pytorch
After you install the newest pytorch you will face torch._C import * DLL load failed problem
to fix that run the ff code
set PYTORCH_BUILD_VERSION=0.4.1

conda install -c pytorch pytorch
set PYTORCH_BUILD_VERSION=0.4.1

@hemangjoshi37a
Copy link

@Abeni18 are you using CPU or GPU??
It is not working for me.
Any solution ??

@hemangjoshi37a
Copy link

Code :

import psutil, os
p = psutil.Process( os.getpid() )
for dll in p.memory_maps():
  print(dll.path)

Output

runfile('C:/Users/hj/autokeras_test.py', wdir='C:/Users/hj') C:\Windows\System32\locale.nls C:\Windows\Globalization\Sorting\SortDefault.nls C:\Windows\System32\en-US\KernelBase.dll.mui C:\Windows\System32\en-US\kernel32.dll.mui C:\Users\hj\Anaconda3\pythonw.exe C:\Users\hj\Anaconda3\python36.dll C:\Users\hj\Anaconda3\DLLs\_sqlite3.pyd C:\Users\hj\Anaconda3\DLLs\_decimal.pyd C:\Users\hj\Anaconda3\pkgs\pywin32-223-py36hfa6e2cd_0\Library\bin\pythoncom36.dll C:\Users\hj\Anaconda3\DLLs\_multiprocessing.pyd C:\Users\hj\Anaconda3\DLLs\_overlapped.pyd C:\Users\hj\Anaconda3\DLLs\_elementtree.pyd C:\Users\hj\Anaconda3\pkgs\pywin32-223-py36hfa6e2cd_0\Lib\site-packages\win32\win32api.pyd C:\Users\hj\Anaconda3\pkgs\python-3.6.6-he025d50_0\DLLs\unicodedata.pyd C:\Users\hj\Anaconda3\DLLs\_bz2.pyd C:\Users\hj\Anaconda3\DLLs\_ctypes.pyd C:\Users\hj\Anaconda3\DLLs\select.pyd C:\Users\hj\Anaconda3\Library\bin\pywintypes36.dll C:\Users\hj\Anaconda3\DLLs\_socket.pyd C:\Users\hj\Anaconda3\Lib\site-packages\win32\_win32sysloader.pyd C:\Windows\System32\kernel32.dll C:\Windows\System32\user32.dll C:\Windows\System32\ntdll.dll C:\Windows\System32\psapi.dll C:\Users\hj\Anaconda3\Library\bin\libiomp5md.dll C:\Users\hj\Anaconda3\Library\bin\mklml.dll C:\Users\hj\Anaconda3\pkgs\.trash\c77b438f-8b95-4c6b-b3f4-c3f5e071ac94 C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5l.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5o.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5i.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5g.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5f.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5ds.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5d.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5p.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5t.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\hdf5.dll C:\Users\hj\Anaconda3\Lib\site-packages\scipy\ndimage\_ni_label.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\ndimage\_nd_image.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\DLLs\sqlite3.dll C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5ac.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5a.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\4f7550e6-c388-48ce-a996-b5c3afee535a C:\Users\hj\Anaconda3\Library\bin\libexslt.dll C:\Users\hj\Anaconda3\pkgs\.trash\faa58ceb-3deb-4216-b6cc-b71765189641 C:\Users\hj\Anaconda3\pkgs\.trash\e65fd056-165d-4c7f-9362-48a0e695b680 C:\Users\hj\Anaconda3\pkgs\.trash\760f1e71-d492-4486-916a-d253ed631cd8 C:\Users\hj\Anaconda3\Library\bin\libxslt.dll C:\Users\hj\Anaconda3\pkgs\.trash\d3d5372e-94f1-4ee6-8cbd-56247851f44a C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5s.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\hdf5_hl.dll C:\Users\hj\Anaconda3\Lib\site-packages\h5py\defs.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\_objects.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5r.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\3b4940da-01cf-4b18-bfda-5bc04c2fe2ca C:\Users\hj\Anaconda3\Lib\site-packages\scipy\spatial\_hausdorff.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\spatial\_distance_wrap.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\spatial\_voronoi.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\spatial\qhull.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\spatial\ckdtree.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\interpolate\interpnd.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\interpolate\_ppoly.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\interpolate\_bspl.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\interpolate\dfitpack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\interpolate\_fitpack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_nnls.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_lsq\givens_elimination.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_group_columns.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_minpack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\linalg\eigen\arpack\_arpack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\csgraph\_reordering.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\csgraph\_min_spanning_tree.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\csgraph\_traversal.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\csgraph\_tools.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\csgraph\_shortest_path.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\_csparsetools.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\_sparsetools.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\integrate\lsoda.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\integrate\_dop.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\integrate\vode.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\integrate\_quadpack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\integrate\_odepack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\special\_ellip_harm_2.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\special\_comb.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\special\specfun.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\special\_ufuncs_cxx.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\libmmd.dll C:\Users\hj\Anaconda3\Library\bin\libifcoremd.dll C:\Users\hj\Anaconda3\Lib\site-packages\scipy\special\_ufuncs.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\cython_lapack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\cython_blas.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\_decomp_update.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\_solve_toeplitz.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\_flinalg.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\_flapack.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\mkl_rt.dll C:\Users\hj\Anaconda3\Lib\site-packages\scipy\linalg\_fblas.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\_lib\_ccallback_c.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\testing.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\util\_move.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\io\msgpack\_unpacker.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\io\msgpack\_packer.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\writers.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\json.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\parsers.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_slsqp.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\reshape.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\groupby.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\reduction.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\skiplist.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\window.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_cobyla.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\5ad030ba-a84d-4807-a3bf-b2133b906c80 C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_zeros.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\moduleTNC.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\_lbfgsb.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\optimize\minpack2.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\linalg\dsolve\_superlu.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\scipy\sparse\linalg\isolve\_iterative.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\sparse.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\internals.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\indexing.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\interval.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\ops.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\join.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\offsets.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\resolution.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\frequencies.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\period.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\index.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\bottleneck\move.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\bottleneck\nonreduce_axis.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\bottleneck\reduce.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\hashing.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\properties.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\algos.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\lib.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\missing.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\hashtable.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\fields.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\timestamps.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\strptime.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\ccalendar.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\parsing.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\timezones.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\timedeltas.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\nattype.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\conversion.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\faabaffb-3915-4520-ad39-5bff99d60079 C:\Users\hj\Anaconda3\pkgs\.trash\9787515b-b6cc-49be-bb68-cff68f96ac0a C:\Users\hj\Anaconda3\pkgs\.trash\cbb0530a-8a3f-4e7e-adaa-10503941dd63 C:\Users\hj\Anaconda3\pkgs\.trash\416772ec-231f-4b55-96e8-aed3fc7959b9 C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\_device.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\_version.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\_poll.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\utils.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\socket.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\context.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\message.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\libzmq-mt-4_2_5.dll C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\error.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\zmq\backend\cython\constants.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\bottleneck\nonreduce.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslib.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\8dc71247-cacf-41be-80d5-8c948f62836e C:\Users\hj\Anaconda3\pkgs\.trash\7167f57d-f034-4cd6-8ff6-e3d40fe4a0c6 C:\Users\hj\Anaconda3\pkgs\.trash\4210679c-73fe-41ba-89c4-bb3302cf98a8 C:\Users\hj\Anaconda3\pkgs\.trash\34cbedf6-069b-4092-96a5-9cc073d8a652 C:\Users\hj\Anaconda3\pkgs\openssl-1.0.2p-hfa6e2cd_0\Library\bin\libeay32.dll C:\Users\hj\Anaconda3\DLLs\_ssl.pyd C:\Users\hj\Anaconda3\DLLs\_hashlib.pyd C:\Users\hj\Anaconda3\Lib\site-packages\torch\_nvrtc.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\2cbcfc16-5452-444d-b6a6-bd718dd85e8f C:\Users\hj\Anaconda3\pkgs\.trash\4a5c9caa-bf3e-422d-b612-9b75ed4a72aa C:\Users\hj\Anaconda3\Lib\site-packages\kiwisolver.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\pkgs\.trash\964b13f8-19b1-49d5-a57d-60684a9d7449 C:\Users\hj\Anaconda3\pkgs\.trash\ad0b6574-5754-4273-9b06-05c6f444c909 C:\Users\hj\Anaconda3\pkgs\.trash\3d047e0c-3bba-4140-be24-94b2966355bc C:\Users\hj\Anaconda3\pkgs\.trash\b2e302e1-7afc-457e-81e4-706b85e392ef C:\Users\hj\Anaconda3\pkgs\.trash\75888ce3-b976-4947-8314-ad747e0fdf88 C:\Users\hj\Anaconda3\Lib\site-packages\pandas\_libs\tslibs\np_datetime.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\DLLs\pyexpat.pyd C:\Users\hj\Anaconda3\pkgs\openssl-1.0.2p-hfa6e2cd_0\Library\bin\ssleay32.dll C:\Users\hj\Anaconda3\pkgs\cryptography-2.3.1-py36h74b6da3_0\Lib\site-packages\cryptography\hazmat\bindings\_openssl.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\ucrtbase.dll C:\Users\hj\Anaconda3\pkgs\cffi-1.11.5-py36hfa6e2cd_1\Lib\site-packages\_cffi_backend.cp36-win_amd64.pyd C:\Windows\System32\msvcp140.dll C:\Users\hj\Anaconda3\DLLs\_asyncio.pyd C:\Users\hj\Anaconda3\Lib\site-packages\_yaml.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\yaml.dll C:\Users\hj\Anaconda3\DLLs\_lzma.pyd C:\Users\hj\Anaconda3\Lib\site-packages\tornado\speedups.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Library\bin\libpng16.dll C:\Users\hj\Anaconda3\Library\bin\zlib.dll C:\Windows\System32\api-ms-win-crt-utility-l1-1-0.dll C:\Users\hj\Anaconda3\pkgs\cryptography-2.3.1-py36h74b6da3_0\Lib\site-packages\cryptography\hazmat\bindings\_constant_time.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\_conv.cp36-win_amd64.pyd C:\Program Files\AVAST Software\Avast\x64\aswhooka.dll C:\Users\hj\Anaconda3\api-ms-win-crt-filesystem-l1-1-0.dll C:\Users\hj\Anaconda3\python3.dll C:\Users\hj\Anaconda3\api-ms-win-crt-process-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-conio-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-time-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-environment-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-math-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-locale-l1-1-0.dll C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5fd.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\h5py\_errors.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\api-ms-win-crt-stdio-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-convert-l1-1-0.dll C:\Users\hj\Anaconda3\Lib\site-packages\h5py\_proxy.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\api-ms-win-crt-string-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-heap-l1-1-0.dll C:\Users\hj\Anaconda3\Lib\site-packages\h5py\h5z.cp36-win_amd64.pyd C:\Windows\System32\wsock32.dll C:\Users\hj\Anaconda3\api-ms-win-core-processthreads-l1-1-1.dll C:\Users\hj\Anaconda3\api-ms-win-core-file-l1-2-0.dll C:\Users\hj\Anaconda3\api-ms-win-core-localization-l1-2-0.dll C:\Users\hj\Anaconda3\api-ms-win-core-synch-l1-2-0.dll C:\Users\hj\Anaconda3\vcruntime140.dll C:\Users\hj\Anaconda3\api-ms-win-core-file-l2-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-crt-runtime-l1-1-0.dll C:\Users\hj\Anaconda3\api-ms-win-core-timezone-l1-1-0.dll C:\Users\hj\Anaconda3\Lib\site-packages\h5py\utils.cp36-win_amd64.pyd C:\Users\hj\Anaconda3\Lib\site-packages\psutil\_psutil_windows.cp36-win_amd64.pyd C:\Windows\System32\msvcr120.dll C:\Windows\System32\dhcpcsvc6.dll C:\Windows\System32\dhcpcsvc.dll C:\Windows\System32\winnsi.dll C:\Windows\System32\IPHLPAPI.DLL C:\Windows\System32\uxtheme.dll C:\Windows\System32\powrprof.dll C:\Windows\System32\wtsapi32.dll C:\Windows\System32\version.dll C:\Windows\System32\WSHTCPIP.DLL C:\Windows\System32\rsaenh.dll C:\Windows\System32\mswsock.dll C:\Windows\System32\cryptsp.dll C:\Windows\System32\wship6.dll C:\Windows\System32\secur32.dll C:\Windows\System32\sspicli.dll C:\Windows\System32\apphelp.dll C:\Windows\System32\cryptbase.dll C:\Windows\System32\msasn1.dll C:\Windows\System32\cfgmgr32.dll C:\Windows\System32\devobj.dll C:\Windows\System32\crypt32.dll C:\Windows\System32\KernelBase.dll C:\Windows\System32\imm32.dll C:\Windows\System32\ws2_32.dll C:\Windows\System32\msctf.dll C:\Windows\System32\ole32.dll C:\Windows\System32\rpcrt4.dll C:\Windows\System32\sechost.dll C:\Windows\System32\oleaut32.dll C:\Windows\System32\gdi32.dll C:\Windows\System32\wininet.dll C:\Windows\System32\setupapi.dll C:\Windows\System32\lpk.dll C:\Windows\System32\shell32.dll C:\Windows\System32\iertutil.dll C:\Windows\System32\advapi32.dll C:\Windows\System32\usp10.dll C:\Windows\System32\imagehlp.dll C:\Windows\System32\msvcrt.dll C:\Windows\System32\nsi.dll C:\Windows\System32\urlmon.dll C:\Windows\System32\shlwapi.dll C:\Windows\System32\apisetschema.dll

Error :

Related to :
ImportError: DLL load failed: The operating system cannot run %1.

Please help me

@nitneuqr
Copy link

nitneuqr commented Oct 26, 2018

These instructions worked for me; it seemed that the environment variables were the issue for me. Thanks a lot!

@akhibh
Copy link

akhibh commented Nov 2, 2018

(tensorflow1) C:\tensorflow1\models\research\object_detection>jupyter notebook object_detection_tutorial.ipynb
Traceback (most recent call last):
File "c:\programdata\anaconda3\envs\tensorflow1\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\programdata\anaconda3\envs\tensorflow1\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\tensorflow1\Scripts\jupyter-notebook.EXE_main
.py", line 5, in
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\notebook\notebookapp.py", line 46, in
from zmq.eventloop import ioloop
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\zmq_init
.py", line 47, in
from zmq import backend
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\zmq\backend_init_.py", line 40, in
reraise(*exc_info)
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\zmq\backend_init_.py", line 27, in
ns = select_backend(first)
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = import(name, fromlist=public_api)
File "c:\programdata\anaconda3\envs\tensorflow1\lib\site-packages\zmq\backend\cython_init
.py", line 6, in
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
since i am using windows 10 ..pls help with reliable answer

@sykrn
Copy link

sykrn commented Feb 13, 2019

@peterjc123 I found that this error, from torch._C import * (ImportError: DLL load failed: The specified module could not be found, rises when I installed Pytorch outside the base environment (using anaconda). But, when I installed Pytorch in the base/main environment, all are okay.
I guess that because only the base environment is included in PATH variable. i.e.

[PythonRoot]
[PythonRoot]\Library\bin
[PythonRoot]\Scripts
[PythonRoot]\bin

where PythonRoot=Anaconda3, (main anaconda directory).

I don't know what's wrong with anaconda.

@harlecin
Copy link

harlecin commented Feb 17, 2019

@sykrn: It seems like the problem is related to the python version that gets installed in your conda environment. I belief base ships with 3.7.1 and this version works with pytorch.

See this issue here and this issue here for more information. The pytorch team is currently implementing a fix from what I read:)

@ShivamPR21
Copy link

ShivamPR21 commented Feb 18, 2019

I have tackled this by creating a full conda environment with anaconda installed in it.
Pl. have a look on my answer here at stackoverflow: https://stackoverflow.com/a/54742569/9071644

@syedmeesamali
Copy link

I have same issue and below are my specs.
System = Windows 10
Type = X64 and CPU only
Python Ver = 3.6
Installation = pip

I have already installed the mkl and mkl-fft intel-openmp and numpy using pip

@ShivamPR21
Copy link

I think you should try conda distro the steps are provided here:
1:) conda create -n pyTorchCPU python=3.6 urllib3
2:) conda activate pyTorchCPU
3:) conda activate numpy matplotlib mkl mkl_fft
4:) conda install pytorch-cpu torchvision-cpu -c pytorch
5:) python -c "import numpy; import torch"

@ShivamPR21
Copy link

This procedure worked for me:
1:) conda create -n pyTorch python=3.6 urllib3
2:) conda activate pyTorch
3:) pip install numpy mkl mkl-fft
4:) pip install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp36-cp36m-win_amd64.whl
5:) pip install torchvision
6:) python -c "import numpy; import torch; print(torch.version)"

@sykrn
Copy link

sykrn commented Feb 27, 2019

@sykrn: It seems like the problem is related to the python version that gets installed in your conda environment. I belief base ships with 3.7.1 and this version works with pytorch.

See this issue here and this issue here for more information. The pytorch team is currently implementing a fix from what I read:)

Okay, that's good news, thanks @harlecin

@Vini-S
Copy link

Vini-S commented Apr 12, 2019


ImportError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import version

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
23 try:
---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
25 finally:

~\Anaconda3\lib\imp.py in load_module(name, file, filename, details)
241 else:
--> 242 return load_dynamic(name, filename, file)
243 elif type_ == PKG_DIRECTORY:

~\Anaconda3\lib\imp.py in load_dynamic(name, path, file)
341 name=name, loader=loader, origin=path)
--> 342 return _load(spec)
343

ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
1 import pandas as pd
----> 2 from keras.models import Sequential
3 from keras.layers import Dense
4 import numpy as np
5 from sklearn.model_selection import train_test_split

~\Anaconda3\lib\site-packages\keras_init_.py in
1 from future import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications

~\Anaconda3\lib\site-packages\keras\utils_init_.py in
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7
8 # Globally-importable utils.

~\Anaconda3\lib\site-packages\keras\utils\conv_utils.py in
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11

~\Anaconda3\lib\site-packages\keras\backend_init_.py in
87 elif _BACKEND == 'tensorflow':
88 sys.stderr.write('Using TensorFlow backend.\n')
---> 89 from .tensorflow_backend import *
90 else:
91 # Try and load external backend.

~\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in
3 from future import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.framework import ops as tf_ops
7 from tensorflow.python.training import moving_averages

~\Anaconda3\lib\site-packages\tensorflow_init_.py in
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25
26 from tensorflow._api.v1 import app

~\Anaconda3\lib\site-packages\tensorflow\python_init_.py in
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\admin\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\admin\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

dataframe = pd.read_csv("dia

@Vini-S
Copy link

Vini-S commented Apr 12, 2019


ImportError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import version

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
23 try:
---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
25 finally:

~\Anaconda3\lib\imp.py in load_module(name, file, filename, details)
241 else:
--> 242 return load_dynamic(name, filename, file)
243 elif type_ == PKG_DIRECTORY:

~\Anaconda3\lib\imp.py in load_dynamic(name, path, file)
341 name=name, loader=loader, origin=path)
--> 342 return _load(spec)
343

ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
1 import pandas as pd
----> 2 from keras.models import Sequential
3 from keras.layers import Dense
4 import numpy as np
5 from sklearn.model_selection import train_test_split

~\Anaconda3\lib\site-packages\keras_init_.py in
1 from future import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications

~\Anaconda3\lib\site-packages\keras\utils_init_.py in
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7
8 # Globally-importable utils.

~\Anaconda3\lib\site-packages\keras\utils\conv_utils.py in
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11

~\Anaconda3\lib\site-packages\keras\backend_init_.py in
87 elif _BACKEND == 'tensorflow':
88 sys.stderr.write('Using TensorFlow backend.\n')
---> 89 from .tensorflow_backend import *
90 else:
91 # Try and load external backend.

~\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in
3 from future import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.framework import ops as tf_ops
7 from tensorflow.python.training import moving_averages

~\Anaconda3\lib\site-packages\tensorflow_init_.py in
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25
26 from tensorflow._api.v1 import app

~\Anaconda3\lib\site-packages\tensorflow\python_init_.py in
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\admin\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\admin\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

dataframe = pd.read_csv("dia

@Vini-S
Copy link

Vini-S commented Apr 12, 2019

plz help me to solve this error

@Vini-S
Copy link

Vini-S commented Apr 12, 2019

plz help me to solve this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment