You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] [Resolved] Docker image openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0,Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory #2918
I have searched related issues but cannot get the expected help.
2. I have read the FAQ documentation but cannot get the expected help.
3. The bug has not been fixed in the latest version.
Describe the bug
In the official Docker image openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0, a bug occurs when using GPU for ONNX model inference, prompting that libonnxruntime_providers_shared.so cannot be found, which causes problems in model loading. This issue has now been resolved. Since issue 2456 (#2456) did not provide a solution in the end, the solution is offered here.
Reproduction
[E:onnxruntime:, provider_bridge_ort.cc:901 Ensure] Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory
2025-09-06 00:43:29.207808824 [E:onnxruntime:, provider_bridge_ort.cc:901 Ensure] Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory
2025-09-06 00:43:29.207809112 [E:onnxruntime:, provider_bridge_ort.cc:901 Ensure] Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory
2025-09-06 00:43:29.207809385 [E:onnxruntime:, provider_bridge_ort.cc:901 Ensure] Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory
[2025-09-06 00:43:29.220] [mmdeploy] [error] [ort_net.cpp:205] unhandled exception when creating ORTNet: OrtSessionOptionsAppendExecutionProvider_Cuda: Failed to load shared library
[2025-09-06 00:43:29.220] [mmdeploy] [error] [net_module.cpp:54] Failed to create Net backend: onnxruntime, config: {
"context": {
"device": "",
"model": "",
"stream": ""
},
In fact, the official Docker image has onnxruntime-gpu-1.8.1 installed in the Python library, but the dependency of mmdeploy is in the precompiled local folder /root/workspace/onnxruntime-linux-x64-1.8.1. Upon checking the files, it turns out that this is not the GPU version of onnxruntime. However, the system uses the files in this location when running onnxruntime (checking via echo $LD_LIBRARY_PATH shows: /root/workspace/mmdeploy/build/lib:/root/workspace/TensorRT/lib:/root/workspace/onnxruntime-linux-x64-1.8.1/lib:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64.
My solution is as follows:
Replace /root/workspace/onnxruntime-linux-x64-1.8.1 with the GPU version, i.e., onnxruntime-gpu-linux-x64-1.8.1. Therefore, I downloaded the GPU version of the same version (https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-gpu-1.8.1.tgz) and placed it in the project files under the working directory app. When building the image, all files in /root/workspace/onnxruntime-linux-x64-1.8.1 are replaced with those from the GPU version.
The relevant Dockerfile code for building the image is as follows:
FROM openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0
# One-click replacement of onnxruntime with GPU version
# -------------------------------
# Assume onnxruntime-linux-x64-gpu-1.8.1.tgz is in the build context (project directory)
WORKDIR /root/workspace
COPY onnxruntime-linux-x64-gpu-1.8.1.tgz /root/workspace/
RUN rm -rf /root/workspace/onnxruntime-linux-x64-1.8.1 \
&& tar -xzf onnxruntime-linux-x64-gpu-1.8.1.tgz \
&& rm onnxruntime-linux-x64-gpu-1.8.1.tgz \
&& mv onnxruntime-linux-x64-gpu-1.8.1 onnxruntime-linux-x64-1.8.1
# Ensure mmdeploy can find the GPU version of the onnxruntime library
ENV LD_LIBRARY_PATH=/root/workspace/onnxruntime-linux-x64-1.8.1/lib:$LD_LIBRARY_PATH
I hope my answer can be helpful.
In fact, there's another way of thinking: making the system default to looking for onnxruntime in the python installation package when searching for onnxruntime. I replaced the path /root/workspace/onnxruntime-linux-x64-1.8.1 in $LD_LIBRARY_PATH with this path, but the program still reported an error when running. I hope that experts can propose a solution for this method in the future.
changed the title [-]Docker image openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0,Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory[/-][+][BUG] [Resolved] Docker image openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0,Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory[/+]on Sep 7, 2025
Activity
llphunhun commentedon Sep 7, 2025
In fact, the official Docker image has onnxruntime-gpu-1.8.1 installed in the Python library, but the dependency of mmdeploy is in the precompiled local folder
/root/workspace/onnxruntime-linux-x64-1.8.1. Upon checking the files, it turns out that this is not the GPU version of onnxruntime. However, the system uses the files in this location when running onnxruntime (checking via echo$LD_LIBRARY_PATHshows:/root/workspace/mmdeploy/build/lib:/root/workspace/TensorRT/lib:/root/workspace/onnxruntime-linux-x64-1.8.1/lib:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64.My solution is as follows:
Replace /root/workspace/onnxruntime-linux-x64-1.8.1 with the GPU version, i.e., onnxruntime-gpu-linux-x64-1.8.1. Therefore, I downloaded the GPU version of the same version (https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-gpu-1.8.1.tgz) and placed it in the project files under the working directory app. When building the image, all files in /root/workspace/onnxruntime-linux-x64-1.8.1 are replaced with those from the GPU version.
The relevant Dockerfile code for building the image is as follows:
I hope my answer can be helpful.
In fact, there's another way of thinking: making the system default to looking for onnxruntime in the python installation package when searching for onnxruntime. I replaced the path /root/workspace/onnxruntime-linux-x64-1.8.1 in $LD_LIBRARY_PATH with this path, but the program still reported an error when running. I hope that experts can propose a solution for this method in the future.
[-]Docker image openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0,Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory[/-][+][BUG] [Resolved] Docker image openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy1.2.0,Failed to load library libonnxruntime_providers_shared.so with error: libonnxruntime_providers_shared.so: cannot open shared object file: No such file or directory[/+]