Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found

Question:

Using tensorflow 2.4.1

When I run my program, I’m getting this error and can’t use my gpu.

I’m using CUDA 11.0, cudnn 8.0

2021-02-07 03:36:18.132005: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
WARNING:tensorflow:From D:/PycharmProjects/pythonProject/models/kpş,i.py:5: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2021-02-07 03:36:19.735127: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-07 03:36:19.739052: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-02-07 03:36:20.715634: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.56GHz coreCount: 16 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-02-07 03:36:20.716281: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-02-07 03:36:20.723519: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-02-07 03:36:20.724040: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-02-07 03:36:20.729436: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-02-07 03:36:20.731800: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-02-07 03:36:20.741580: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-02-07 03:36:20.745576: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-02-07 03:36:20.746657: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found
2021-02-07 03:36:20.746971: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1757] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2021-02-07 03:36:20.836861: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-02-07 03:36:20.837144: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0 
2021-02-07 03:36:20.837314: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N 
2021-02-07 03:36:20.837493: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
Asked By: Doctor Octopus

||

Answers:

watch this video to solve this problem,
this file not found error arises due to the missing of Microsoft visual studio C++ reproducible file in the CUDA folder.
additional;
with the PyTorch in conda environment, there is no addition CUDA and Cudnn installation, because after type conda install pytorch, conda installs both CUDA and cudnn into that conda environment.

Answered By: nipun

I think I can help you with providing a cudnn64_8.dll file (this is the download link: https://www.dll-files.com/cudnn64_8.dll.html). When you get the file, you can just put in your bin directory. For example, usually in windows platform, you can put it into C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.3bin.

Answered By: Billy Luo

The missing dll file is located in the cuDNN folder. I was able to resolve the issue by copying the cudnn64_8.dll file to the CUDA folder, i.e., C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.6bin.

cuDNN is listed as a requirement for tensorflow to work and you can download it here. You need to register a developer account first though.

Answered By: P1NHE4D

I just had this issue as well after following all of the installation instructions for CuDNN. The root cause of the problem is very simple. In the installation instructions, it tells you to add <root>NVIDIACUDNNv8.x to your PATH. At least for Tensorflow, this happens to be wrong. You need to add <root>NVIDIACUDNNv8.xbin to your PATH. That should fix the problem. It did for me.

I see a couple answers talking about moving the cudnn64_8.dll file to C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.6bin. The reason why this works is that CUDA automatically adds that bin directory to your PATH when you install it. So, moving the cudnn64_8.dll there effectively adds it to your PATH.

I’d rather keep things in their proper location so I like this way more.

Answered By: Sintrias

I’ve stumbled at this error as well and what I’ve figured is that cudnn requires a different installation. Here is a guide for the installation and the packages required https://developer.nvidia.com/cudnn.
*edit -> in the link above you can download the cuddn version that tensorflow requires, then you will place them in the needed folders and that will fix your issue.

Answered By: Thanos Vaskantiras

This will solve your problem:

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
Answered By: Amudhavel
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.