ImportError: Could not find 'cudnn64_7.dll'

2019-07-26 01:51发布

问题:

I am encountering the following error:

 Traceback (most recent call last):   File
 "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\self_check.py",
 line 87, in preload_check
     ctypes.WinDLL(build_info.cudnn_dll_name)   File "C:\Anaconda\envs\tensorflow\lib\ctypes\__init__.py", line 348, in
 __init__
     self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):   File "<stdin    ", line 1, in
 <module       File
 "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\__init__.py",
 line 22, in <module    
     from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import   File
 "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py",
 line 49, in <module    
     from tensorflow.python import pywrap_tensorflow   File "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
 line 30, in <module    
     self_check.preload_check()   File "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\self_check.py",
 line 97, in preload_check
     % (build_info.cudnn_dll_name, build_info.cudnn_version_number)) ImportError: Could not find 'cudnn64_7.dll'. 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 this DLL is often found in a different
 directory from the CUDA DLLs. You may install the necessary DLL by
 downloading cuDNN 7 from this URL: https://developer.nvidia.com/cudnn

I have installed the required "cuDNN 7" files in the directory mentioned in the %Path% environment, yet the statement

import tensorflow as tf

is not working. I have downloaded the cuDNN 7 files from the mentioned site:

https://developer.nvidia.com/cudnn

I have gone through all the answers on StackOverflow and yet I am getting stuck with the same error. Please guide me on how to run the above statement.

回答1:

Have you exported the PATH? Sometimes, we do not notice those small details.



回答2:

Here is what I did.

Step 1) Installed 'NVIDIA GEFORCE EXPERIENCE' in my computer to check my Driver version.

Step 2) The driver version was an old one. Update was available. So I updated my Graphic driver.

My GPU properties now are:-

NVIDIA GEFORCE EXPERIENCE Version 3.14.1.48
GeForce 940MX
Driver Version 398.82
Intel(R) Core(TM) i5-7200U CPU @2.50GHz
7.9 GB RAM

Now, through conda environment ( I created an environment named 'tensorflow' ), when I executed the statement

(tensorflow) C:\Users\Arnab Sinha>pip install --ignore-installed --upgrade tensorflow-gpu

I encountered the following message :-

pandas 0.23.4 requires python-dateutil>=2.5.0, which is not installed.

pandas 0.23.4 requires pytz>=2011k, which is not installed.

I then installed the required packages by executing the following commands one after the other

pip install python-dateutil

and

pip install pytz

after which I ran the command in Python 3.6.6

import tensorflow as tf

and then

print(tf.__version__)

which gave the output

1.10.0

Here is how I installed Tensorflow 1.10.0 into my computer. The Anaconda Navigator however does not have the update of Tensorflow 1.10.0. Please inform me if you have found the update for it.