Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Tensorflow-GPU) import tensorflow ImportError: Could not find 'cudnn64_7.dll'

After created tensorflow environment under anaconda, I installed tensorflow-gpu. Then I was trying to import tensorflow to verify if it's correctly installed, but got this error:

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

Setup is:

NVIDIA GTX 1080
CUDA 9.0
cuDNN 6.0
tensorflow-gpu 1.5

Environment Variables are:

CUDA_PAT: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
CUDA_PATH_V9_0: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

The %Path% variables are:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp
C:\Users\yshen\AppData\Local\cudnn-8.0-windows10-x64-v6.0\cuda\bin

it is obvious that I installed cuDNN6.0, don't why the error shows "Could not find 'cudnn64_7.dll' ". Why it automatically searches cudnn64_7.dll instead of cudnn64_6.dll?

like image 968
JShen Avatar asked Feb 09 '18 03:02

JShen


3 Answers

Also, I got below error when I installed TensorFlow 1.8. I have the Anaconda environment.

"ImportError: Could not find 'cudnn64_7.dll'"

But after I installed Nvidia cuDNN v7.1.3 (April 17, 2018), for CUDA 9.0, everything started to work. Please note that one needs to sign up as a Nvidia developer to be able to download the installation package(s).

Then, just follow the instructions in the page : cudnn-install

For Windows:

3.3. Installing cuDNN on Windows

The following steps describe how to build a cuDNN dependent program. In the following sections:

-your CUDA directory path is referred to as C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

-your cuDNN directory path is referred to as <installpath>

  1. Navigate to your <installpath> directory containing cuDNN.

  2. Unzip the cuDNN package. -cudnn-9.0-windows7-x64-v7.zip or -cudnn-9.0-windows10-x64-v7.zip

  3. Copy the following files into the CUDA Toolkit directory.

    • Copy <installpath>\cuda\bin\cudnn64_7.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin.
    • Copy <installpath>\cuda\ include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include.
    • Copy <installpath>\cuda\lib\x64\cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64.
  4. Set the following environment variables to point to where cuDNN is located. To access the value of the $(CUDA_PATH) environment variable, perform the following steps:

    • Open a command prompt from the Start menu.
    • Type Run and hit Enter.
    • Issue the control sysdm.cpl command.
    • Select the Advanced tab at the top of the window.
    • Click Environment Variables at the bottom of the window.
    • Ensure the following values are set: Variable Name: CUDA_PATH Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
  5. Include cudnn.lib in your Visual Studio project.

    • Open the Visual Studio project and right-click on the project name.
    • Click Linker > Input > Additional Dependencies.
    • Add cudnn.lib and click OK.
like image 135
mpeli Avatar answered Oct 18 '22 03:10

mpeli


According to you previous answer, you seem to find out prebuilt tensorflow-gpu 1.5 is not compatible with CUDA 9.0 + CudNN 6.0. There are two possible solutions for your answer, if you want to use tensorflow-gpu 1.5:

1, upgrade your CUDA tool chain to CUDA 9.0 +Cudnn 7.0 (currently Cudnn 7.0.5 for CUDA 9.0).

2, recompile the tensorflow-gpu 1.5 target for CUDA 9.0 + cudnn 6.0.

I suggest choosing the first option for ease. But the official webpage of tensorflow 1.5 dose not deny the possibility of option 2: https://github.com/tensorflow/tensorflow/releases/tag/v1.5.0

like image 36
user1586947 Avatar answered Oct 18 '22 02:10

user1586947


In my case i needed to install old cuDNN libraries linked here

like image 1
mustafa candan Avatar answered Oct 18 '22 04:10

mustafa candan