Could not load library cudnn_ops_infer64_8.dll. Error code 126 Please make sure cudnn_ops_infer64_8.dll is in your library path.
I've tried searching online but it's been hours and I haven't found anything. I would really appreciate anyone sharing his thoughts. I'm trying to run ai-benchmark library which internally tests for performance of gpu against popular datasets. (see image)

- 2,229
- 4
- 25
- 51
-
Once check your version correctly. tensorflow_gpu-2.4.0 python 3.6-3.8 cudnn8.0 CUDA11.0 – Krishna Rohith Feb 17 '22 at 10:36
6 Answers
You should have downloaded CUDA zip file. Go to that file, extract it and in the bin folder you will see
cudnn_adv_infer64_8.dll
cudnn_adv_train64_8.dll
cudnn_cnn_infer64_8.dll
cudnn_cnn_train64_8.dll
cudnn_ops_infer64_8.dll
cudnn_ops_train64_8.dll
Copy these files into your nvidia gpu computing toolkit\cuda\bin folder.
-
4For me paste into "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin" from "cuda\bin" in cudnn-11.3-windows-x64-v8.2.1.32.zip. thx madm4x. – Nando Jun 24 '21 at 14:50
-
Interestingly, in the installation manual they point out to copy only the cudnnxx_x.dll file from the bin folder. But with your solution, the error disappeared. – Luis Garcia Oct 20 '21 at 12:10
-
1
-
@DiegoRueda Cause, the message said, to copy those in to 'library' folder of CUDA. So go to your cudnn folder, navigate to bin, where you have .dll files and find the respective .dll file and copy it to Nvidia GPU Computing toolkit\CUDA\v11.5\lib\x64 . – Krishna Rohith Feb 17 '22 at 10:13
-
To my surprise, this isn't working, I am still getting that same error message – Krishna Rohith Feb 17 '22 at 10:26
-
Now I am getting "Could not locate zlibwapi.dll. Please make sure it is in your library path!" error – Shirish Bajpai Mar 29 '22 at 13:19
In my case, it is because I did not install zlib
, and after I install it, it works!!

- 939
- 1
- 7
- 8
-
4Exactly my case too. The NVIDIA instructions did say copying the file zlibwapi.dll over to the bin directory under CUDA. My config is CUDA Toolkit 11.5, CuDNN 8.3.1.22. – Giao Vu Nov 30 '21 at 09:57
-
2Can confirm, copying zlibwapi.dll from archive (dll_x64 fold) to .../CUDA/v11.6/bin worked for me with CUDA 11.6 and CUDNN 8.3. It seems you don't even have to copy the cudnn_xxx.dlls to the CUDA bin folder from CUDNN as long as CUDNN is also in your path. – eXPRESS Mar 16 '22 at 13:06
-
CUDA 11.8 and CUDNN 8.9 here. Copying the zlibwapi.dll into the bin folder for my CUDA/v11.8/bin *didnt* work for mine. I have already added the directories to my path. – fatbringer Aug 07 '23 at 06:02
Leaving an answer to respond to Diego Rueda's comment on MADM4X's post.
I ran into the same issue: copied the cuDNN files into my CUDA toolkit install and received the Error Code 126.
You need to specifically download/copy cuDNN Version 8.1.x. If you use the latest version (8.3.x) you'll receive the error Code described in the original post.
TensorFlow doesn't seem to be as sensitive to the Toolkit's version (I'm running 11.4), but I haven't explored all of the features to make sure they work.
For more context, you can find the specific CUDA/cuDNN versions listed on TensorFlow's website.

- 163
- 1
- 8
-
2The following configuration works for me: Windows 11 64-bit, Python 3.9.9, Tensorflow 2.7.0, CUDA 11.5.0_496, cudnn 8.2.4.15. Before that I got the same error as the OP when using the latest cudnn 8.3.0.98 instead (even though according to nvidia it is the correct match for CUDA 11.5). – robert Nov 16 '21 at 15:02
-
4it also worked for me: downloaded and installed **CUDA Toolkit 11.5**, then Download the incompatible cuDNN v8.2.4 (September 2nd, 2021), for **CUDA 11.4**, placed the files in correct folders as in https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html, and voila, THE PAIN IS GONE! THX @robert – jib fashr Nov 27 '21 at 18:16
-
same here, I downloaded **cuda_11.6.0_511.23_windows** and **cudnn_8.3.2.44_windows** and place all the dll files from the cuDNN bin folder as instructed here [https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installwindows](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installwindows) , I am using **TensorFlow 2.5** – ahmedshahriar Feb 21 '22 at 13:49
Jupyter notebook was locking the file in my case, closing Jupyter notebook server solved it for me.

- 1,618
- 16
- 24
I had the same problem and just went thru the Prerequisites: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#prerequisites-windows
Check if all the cudnn[.dll, .h, .lib]* files and zlivwapi.dll are in the system path. Once all are in path, the problem is solved.

- 102
- 6
Have faced the same issue, could able to fix it by downloading the files from CUDNN and copy to "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDNN\v5.1\bin".

- 61
- 8