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
Asked Answered
I

7

14

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)

Impudent answered 24/2, 2021 at 17:2 Comment(2)
Once check your version correctly. tensorflow_gpu-2.4.0 python 3.6-3.8 cudnn8.0 CUDA11.0Soph
For me, it was because the file path had special characters. Once that was corrected, then it worked fine.Stockwell
H
22

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.

Hairstreak answered 2/3, 2021 at 16:44 Comment(6)
For 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.Hinckley
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.Directorate
I have the same error, but the files have been copied already.Witchcraft
@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 .Soph
To my surprise, this isn't working, I am still getting that same error messageSoph
Now I am getting "Could not locate zlibwapi.dll. Please make sure it is in your library path!" errorLoadstone
B
12

In my case, it is because I did not install zlib, and after I install it, it works!!

enter image description here

Beasley answered 28/11, 2021 at 10:2 Comment(3)
Exactly 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.Dierdredieresis
Can 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.Loewi
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.Headmistress
N
8

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.

Neuter answered 11/11, 2021 at 22:37 Comment(3)
The 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).Mis
it 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 docs.nvidia.com/deeplearning/cudnn/install-guide/index.html, and voila, THE PAIN IS GONE! THX @MisRights
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 , I am using TensorFlow 2.5Xylidine
F
3

Jupyter notebook was locking the file in my case, closing Jupyter notebook server solved it for me.

Forfar answered 14/6, 2022 at 10:44 Comment(2)
Closing Spyder worked in my case. Thanks @Forfar !Twibill
This saved me a ton of time. I would've never guess it.Sensibility
C
1

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.

Cleavage answered 9/8, 2022 at 15:31 Comment(0)
H
0

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".

Halfbaked answered 1/2, 2023 at 13:8 Comment(0)
H
0

In was working with a conda environment so I updated the PATH variable and it started working:

import os
os.environ["PATH"] += os.environ["PATH"] + ";" +  r"C:\ProgramData\Anaconda3\envs\myenv\Lib\site-packages\nvidia\cudnn\bin" + ";" + r"C:\ProgramData\Anaconda3\envs\myenv\Lib\site-packages\nvidia\cublas\bin"

I had installed the Nvidia libraries by:

pip install nvidia-cublas-cu11 nvidia-cudnn-cu11

This is will add both cudnn_ops_infer64_8.dll & cublasLt64_11.dll

Hypertonic answered 18/10, 2023 at 5:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.