ERROR: Could Not Open libnvinfer_custom_impl_Yolo.so After Converting to PyInstaller Package

I am encountering an issue when running my DeepStream pipeline after converting it into a standalone package using PyInstaller . The error occurs when the nvinfer plugin tries to load a custom YOLO inference library:

../nvdsinfer/nvdsinfer_func_utils.cpp:31 Could not open lib: /libnvdsinfer_custom_impl_Yolo.so, 
error string: libnvinfer.so.8: cannot open shared object file: No such file or directory

Context:

  • The DeepStream application works perfectly when run directly from the source code.
  • After packaging the application with PyInstaller, the above error appears.
  • The custom implementation file libnvdsinfer_custom_impl_Yolo.so is already included in the package directory (DeepStream-Yolo).

PyInstaller Configuration:

Here’s a snippet of the relevant PyInstaller configuration:

datas=[
    ("processor/video/DeepStream-Yolo", "DeepStream-Yolo"),
],
hiddenimports=["passlib.handlers.bcrypt"],

The custom YOLO library file (libnvdsinfer_custom_impl_Yolo.so ) exists in the correct packaged path but seems to fail due to missing dependencies like libnvinfer.so.8 .

What I’ve Tried:

  1. Verified that the library libnvdsinfer_custom_impl_Yolo.so exists in the correct path within the PyInstaller package.
  2. Ensured that TensorRT libraries are installed and properly linked on the system (libnvinfer.so.8).
  3. Tested with LD_LIBRARY_PATH to point explicitly to TensorRT libraries during runtime, but no success.

Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
• The pipeline being used

Are the same version of Jetpack installed on the packaging and running platforms?

For DS-7.1/Jetpack 6.1, Tensort has been upgraded to 10.3

It may look similar to this topic