microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.09k stars 2.84k forks source link

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

Open pradeepkc11 opened 6 months ago

pradeepkc11 commented 6 months ago

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

manickavela29 commented 6 months ago

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

HShamimGEHC commented 6 months ago

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

MinTse-Hsu commented 6 months ago

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.

faizaanscnz commented 1 month ago

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