ORB-HD / deface

Video anonymization by face detection
MIT License
684 stars 95 forks source link

Failed to load library libonnxruntime_providers_tensorrt.so with error #53

Closed bmox closed 11 months ago

bmox commented 1 year ago

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.
fmmix commented 12 months ago

This has nothing to do with this repo. Your tensorrt lib is not linked correctly.

See as references: https://github.com/NVIDIA/TensorRT/issues/2596 https://github.com/NVIDIA/TensorRT/issues/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