Failed to load library libonnxruntime_providers_tensorrt.so with error
bmox opened this issue · comments
I'm running this on Google Colab
!pip install deface
!pip install onnx==1.15.0
!pip install onnxruntime-gpu==1.16.2
!pip install tensorrt==8.6.1.post1
!deface /content/gdrive/MyDrive/input_video/a.mp4 --replacewith mosaic --thresh 0.4 -o /content/gdrive/MyDrive/input_video/a_blur.mp4
EP Error /onnxruntime_src/onnxruntime/core/session/provider_bridge_ort.cc:1193 onnxruntime::Provider& onnxruntime::ProviderLibrary::Get() [ONNXRuntimeError] : 1 : FAIL : Failed to load library libonnxruntime_providers_tensorrt.so with error: libnvinfer.so.8: cannot open shared object file: No such file or directory
when using ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'AzureExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
Running on CUDAExecutionProvider.
This has nothing to do with this repo. Your tensorrt lib is not linked correctly.
See as references:
NVIDIA/TensorRT#2596
NVIDIA/TensorRT#1817
For me I had to do this:
python3 -c "import tensorrt; print(tensorrt.__path__)"
Output
['/usr/local/lib/python3.10/dist-packages/tensorrt']
The lib for me was actually under (so scoop around a bit in your package folders):
/usr/local/lib/python3.10/dist-packages/tensorrt_libs
echo $LD_LIBRARY_PATH
/usr/local/nvidia/lib:/usr/local/nvidia/lib64
As you can see the lib was not in my path.
You can add it via:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/python3.10/dist-packages/tensorrt_libs"
afterwords it should look like this:
echo $LD_LIBRARY_PATH
/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/lib/python3.10/dist-packages/tensorrt_libs
Hope it helps