Tensorflow Importerror: "dll Load Failed" And "no Module Named Pywrap_tensorflow_internal"
Solution 1:
In my case, either cudnn v5 or v6 cannot work alone. I looked into the self check script, it seems that the proper installation of both cudnn64_5.dll and cudnn64_6.dll are checked:
cudnn5_found = Falsetry:
cudnn5 = ctypes.WinDLL("cudnn64_5.dll")
cudnn5_found = Trueexcept OSError:
candidate_explanation = Trueprint("""
- Could not load 'cudnn64_5.dll'. The GPU version of TensorFlow
requires that this DLL be installed in a directory that is named in
your %PATH% environment variable. Note that installing cuDNN is a
separate step from installing CUDA, and it is often found in a
different directory from the CUDA DLLs. You may install the
necessary DLL by downloading cuDNN 5.1 from this URL:
https://developer.nvidia.com/cudnn""")
cudnn6_found = Falsetry:
cudnn = ctypes.WinDLL("cudnn64_6.dll")
cudnn6_found = Trueexcept OSError:
candidate_explanation = Trueifnot cudnn5_found ornot cudnn6_found:
print()
ifnot cudnn5_found andnot cudnn6_found:
print("- Could not find cuDNN.")
elifnot cudnn5_found:
print("- Could not find cuDNN 5.1.")
else:
print("- Could not find cuDNN 6.")
print("""
The GPU version of TensorFlow requires that the correct cuDNN DLL be
installed
in a directory that is named in your %PATH% environment variable. Note
that
installing cuDNN is a separate step from installing CUDA, and it is often
found in a different directory from the CUDA DLLs. The correct version of
cuDNN depends on your version of TensorFlow:
* TensorFlow 1.2.1 or earlier requires cuDNN 5.1. ('cudnn64_5.dll')
* TensorFlow 1.3 or later requires cuDNN 6. ('cudnn64_6.dll')
if either v5 or v6 is not found in Path, an OSError will occur. So I put both in my Path environment variable, and the check passed.
Solution 2:
This is a known issue while installing tensorflow-gpu.
If you are using conda the best way to solve this problem is by doing a conda installation of tensorflow-gpu. The steps are given below. (Tested in both Windows 10 and Ubuntu 16.04)
Uninstall existing installation of tensorflow-gpu
pip uninstall tensorflow-gpu
Then install the tensorflow-gpu using conda
conda install tensorflow-gpu
This should install tensorflow-gpu in your conda environment with all the dependencies.
If you are not using anaconda distribution of python, you may try using the correct versions of cudatoolkit, CuDNN and python. A list of common errors and their corresponding github threads with solutions can be found here.
https://www.tensorflow.org/install/errors
I would recommend you to use conda install than pip install if you don't want to spent much time on figuring out what went wrong and how to fix it.
Solution 3:
The script tensorflow_self_check.py works perfectly in my case. It points out that I miss the file cudnn64_6.dll of cuDNN v6. It is important to notice that in the official guide of TensorFlow for Window (https://www.tensorflow.org/install/install_windows), they insist that it must be cuDNN v5.1 with cuDNN64_5.dll ! They should update this guide by adding this tensorflow_self_check.py script.
EDIT: I should read carefully the release note of TensorFlow 1.3.0 https://github.com/tensorflow/tensorflow/blob/r1.3/RELEASE.md: "All our prebuilt binaries have been built with cuDNN 6. We anticipate releasing TensorFlow 1.4 with cuDNN 7."
Post a Comment for "Tensorflow Importerror: "dll Load Failed" And "no Module Named Pywrap_tensorflow_internal""