onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

Failed to load library libonnxruntime_providers_cuda.so I am getting the following erro

Open pradeepkc11 opened this issue 1 year ago • 1 comments

Describe the issue

2024-02-23 12:12:19.240097373 [E:onnxruntime:Default, provider_bridge_ort.cc:1546 TryGetProviderInfo_CUDA] /onnxruntime_src/onnxruntime/core/session/provider_bridge_ort.cc:1209 onnxruntime::Provider& onnxruntime::ProviderLibrary::Get() [ONNXRuntimeError] : 1 : FAIL : Failed to load library libonnxruntime_providers_cuda.so with error: libcudnn.so.8: cannot open shared object file: No such file or directory I have installed GPU with CUDA 12.2 and when i run my model with onnxruntime i am getting this issue

To reproduce

try to solve the issue and steps to solve it

Urgency

No response

Platform

Other / Unknown

OS Version

Ubuntu 22.04

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.17.0

ONNX Runtime API

Python

Architecture

X64

Execution Provider

CUDA

Execution Provider Library Version

CPU

pradeepkc11 avatar Feb 23 '24 06:02 pradeepkc11

Try adding libcudnn.so lib path to LD_PRELOAD variable, run this below CMD before running inference

export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib

manickavela29 avatar Feb 23 '24 12:02 manickavela29

@pradeepkc11, I am also running into this issue. Please let me know if you find a solution.

HShamimGEHC avatar Feb 26 '24 15:02 HShamimGEHC

Make sure you have the correct cuDNN version installed, you can check here for version requirments between onnx runtime and CUDA (cuDNN).

In my case, I use onnx runtime version 1.14.1, but I have libcudnn 7 installed in my ubuntu machine, so I follow this guide to install libcudnn 8, after that I'm able to run application with onnx runtime.

MinTse-Hsu avatar Mar 06 '24 03:03 MinTse-Hsu

you can use these instruction some time onnx does not detect the cudnn path

  1. Check for Multiple cuDNN Versions find / -name 'libcudnn*'

  2. Check now multiple versions: ls -l your path/libcudnn*

  3. If multiple cudnn exits remove it and keep that one you will use Remove existing files (if necessary): remove redundant files rm your path/libcudnn*

  4. Check now: ls -l your path/libcudnn*

##################################################### Now edit bashrc

  1. Edit ~/.bashrc File nano ~/.bashrc export LD_LIBRARY_PATH=your path (give your path to gpt to make bshrc path so you can add in) :$LD_LIBRARY_PATH

  2. Reboot: source ~/.bashrc

  3. Verify the Environment Variable echo $LD_LIBRARY_PATH

faizaanscnz avatar Jul 19 '24 09:07 faizaanscnz