[Bug] Hailo8L Model Runtime Not Detected After PyInstaller Build on Raspberry Pi 5

Problem Summary

I’m experiencing a runtime issue when running a PyInstaller-built executable of my AI application that uses the Hailo8L accelerator and DeGirum tools on a Raspberry Pi 5 running Raspbian.

The application works perfectly when executed directly via Python (python person_recognition.py), but fails only after being packaged with PyInstaller.

Error:

degirum.exceptions.DegirumException: Model 'yolo11n_silu_coco--640x640_quant_hailort_hailo8l_1' does not have any supported runtime/device combinations that will work on this system.

System Context

  • Hardware: Raspberry Pi 5
  • OS: Raspbian (64-bit)
  • Acceleration: Hailo8L
  • AI SDK: DeGirum tools
  • Model: yolo11n_silu_coco--640x640_quant_hailort_hailo8l_1
  • Packaging Tool: PyInstaller (one-folder and one-file modes both tested)

What Works

  • Running the app directly using the Python interpreter loads the model and executes inference successfully using the Hailo8L device.
  • The Hailo runtime and DeGirum setup are correctly installed and functioning in the native environment.

What Fails

  • When the exact same code is packaged using PyInstaller, running the resulting binary throws the above DegirumException.
  • It appears the packaged app cannot detect or interface with the Hailo runtime/device.

My Hypothesis

  • PyInstaller might be omitting some essential shared libraries or runtime configs used by the Hailo runtime.
  • There may be environment variables or device detection logic that breaks inside the frozen PyInstaller environment.
  • DeGirum or Hailo may rely on dynamic linking or device initialization paths that aren’t preserved in the PyInstaller build.

What I’ve Tried

  • Running PyInstaller with:
    • --collect-all degirum
    • --add-binary for suspected .so files
    • --debug all to trace import and execution logs
  • Comparing os.environ and sys.path between native and packaged executions
  • Manually verifying that Hailo runtime libraries are present in the dist folder

Hi @AbnerDC
Can you please share what typing degirum sys-info in terminal returns?

Sure, this is the result

Devices:
HAILORT/HAILO8L:

  • @Index’: 0
    Board Name: Hailo-8
    Device Architecture: HAILO8L
    Firmware Version: 4.20.0
    ID: ‘0000:01:00.0’
    Part Number: HM21LB1C2LAE
    Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP
    Serial Number: “HLDDLBB243900138\x10HM21LB1C2LAE”
    N2X/CPU:
  • @Index’: 0
  • @Index’: 1
    TFLITE/CPU:
  • @Index’: 0
  • @Index’: 1
    Software Version: 0.15.1

Thanks for providing this information. We have never tried PyInstaller before. We will see if we can replicate this. Your hypothesis about dynamic linking and missing libraries could be right.

Thanks, meanwhile could you suggest a tool to create a compiled python program that works well with degirum?

Hi @AbnerDC
Can you explain your use case and the motivation for this approach? It gives us a better idea on the best approach.

Sure, I already finish a people counting program made in python and raspberry pi 5.
Now I want to distribute this software in some other raspberry pi’s without exposing the code.

Hello @AbnerDC ,

To fix this issue, get PyInstaller to package everything for the degirum package by following these steps:

  1. Create hook-degirum.py in the current directory:
# hook-degirum.py
from PyInstaller.utils.hooks import collect_all

datas, binaries, hiddenimports = collect_all('degirum')
  1. Re-run the pyinstaller command with --additional-hooks-dir .

This will package all of the necessary plugin libraries to get PySDK to work through PyInstaller.

For example:
If your application is testVideoStream.py, you can run this command after creating the hook file:
pyinstaller --name testVideoStream --onedir --additional-hooks-dir . testVideoStream.py

Let me know if you have any issues!

2 Likes

Thanks for your response I’ll try in the weekend