On Windows, TensorFlow reports either or both of the following errors after executing an import tensorflow
statement:
No module named \"_pyw
Dll not found. Install Visual C++ 2015 redistributable to fix.
The problem was the cuDNN Library for me - for whatever reason cudnn-8.0-windows10-x64-v6.0 was NOT working - I used cudnn-8.0-windows10-x64-v5.1 - ALL GOOD!
My setup working with Win10 64 and the Nvidia GTX780M:
If you run Windows 32 be sure to get the 32 bit versions of the files mentioned above.
I have Win7 Pro 64-bit on AMD cpu, no gpu. I was following the instructions under "Installing with native pip" at https://www.tensorflow.org/install/install_windows. The installation step went ok but the attempt to import tensorflow produced the infamous:
ImportError: No module named '_pywrap_tensorflow_internal'
This seems to be one of those situations where a lot of unrelated things can go wrong, depending on configuration, which all cascade through to the same error.
In my case, installing MSVCP140.DLL was the answer.
You have MSVCP140.DLL
already if
C:\Windows\System32\MSVCP140.DLL
, ANDC:\Windows\SysWOW64\MSVCP140.DLL
.I installed it manually, which was unnecessary (the redistributable is not the whole Visual C++ development mess and isn't large). Use the link posted earlier in this thread to install it: Visual C++ 2015 redistributable.
Also, I recommend that you override the default install directory for Python and put it anywhere not under C:\Program Files
, because Windows tries to write-protect files there, which causes problems later.
Either error indicates that your system has not installed MSVCP140.DLL
,
which TensorFlow requires.
To fix this error:
MSVCP140.DLL
is in your %PATH%
variable.MSVCP140.DLL
is not in your %PATH%
, install the
Visual C++ 2015 redistributable (x64 version), which contains this DLL.cuDNN causes my problem. PATH variable doesn't work for me. I have to copy the files in my cuDNN folders into respectful CUDA 8.0 folder structure.
I posted a general approach for troubleshooting the "DLL load failed" problem in this post on Windows systems. For reference:
Use the DLL dependency analyzer Dependencies to analyze
<Your Python Dir>\Lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd
and determine the exact missing DLL (indicated by a?
beside the DLL). The path of the .pyd file is based on the TensorFlow 1.9 GPU version that I installed. I am not sure if the name and path is the same in other TensorFlow versions.Look for information of the missing DLL and install the appropriate package to resolve the problem.