'Tensorflow-gpu cudnn_cnn_infer64_8.dll not recognised [Error code 193]

When trying to use Tensorflow (gpu), it won't run because of this :

Could not load library cudnn_cnn_infer64_8.dll. Error code 193 Please make sure cudnn_cnn_infer64_8.dll is in your library path!

The thing is, that I have this lib :

path to libs

and I've added the environnement variables :

enter image description here

Full error message :

To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-01-02 00:22:39.438945: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /device:GPU:0 with 5468 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:01:00.0, compute capability: 8.6 2022-01-02 00:22:40.466945: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 5468 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:01:00.0, compute capability: 8.6 2022-01-02 00:22:41.646700: I tensorflow/stream_executor/cuda/cuda_blas.cc:1774] TensorFloat-32 will be used for the matrix multiplication. This will only be logged once. 2022-01-02 00:22:41.780145: I tensorflow/stream_executor/cuda/cuda_dnn.cc:366] Loaded cuDNN version 8301 Could not load library cudnn_cnn_infer64_8.dll. Error code 193 Please make sure cudnn_cnn_infer64_8.dll is in your library path!



Solution 1:[1]

It was simply because I can't read the doc properly...

I installed all the latest versions of CUDA, cuDNN and Tensorflow GPU, but they aren't compatible.

here is what helped me : https://www.tensorflow.org/install/source_windows?hl=fr

So I installed :

  • tensorflow_gpu-2.6
  • CUDA 11.2
  • cuDNN 8.1

and guess what, everything works fine now !

So in case of :

Could not load library cudnn_cnn_infer64_8.dll. Error code 126

or

Could not load library cudnn_cnn_infer64_8.dll. Error code 193

Re-install CUDA with the recommended versions and don't forget to update your PATH

Solution 2:[2]

My case. The PATH has been duplicated.

error
PATH=****;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\libnvvp;*****;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\libnvvp;

correct
PATH=****;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\libnvvp;

The cuda installers add path. Duplicated paths often will cause errors.

Solution 3:[3]

I have the same problem when I use CUDA v11.6 and cuDNN v8.4.

I solve it by changing CUDA v11.6 to v11.4 and cuDNN v8.4 to v8.2.4

Here is CUDA and cuDNN

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Val_
Solution 2
Solution 3 yuchen