Getting Segmentation fault error when using hailopython

When I try using hailopython plugin in my pipeline I get ‘Segmentation fault’

1 Like

The hailopython plugin is used to run python code inside the Gstreamer pipeline.
See documentation for this plugin in hailopython documentation.

All uncaught exceptions from the python code running in this plugin will cause a “Segmentation fault” error :face_with_diagonal_mouth:.

Note that most TAPPAS pipelines does not require python dependencies to run. Hailo’s python dependencies are installed in Hailo’s virtual environment.
As a first step make sure you enable Hailo’s virtual environment when using hailopython.

In addition make sure other python dependencies are installed in your environment. Most of the time the culprit is a missing pip install.

A good idea is to add somthing like this to your code:

# Try to import hailo python module
try:
    import hailo
except ImportError:
    exit("Failed to import hailo python module. \
Make sure you are in hailo virtual environment.")

If you found this (or other posts) useful, please hit the :heart: button to help promote it to more people. Have insights, corrections, or questions? Share your thoughts in the comments!

As a side note, please be aware that Gstreamer uses multi-thread, not multi-process to run each plugin element. If you create a global variable in a python module, it is accessible from all threads that import that module.
This means that if the same python file is used multiple times in your pipeline as it can be the case if you have parallel branches, and if you define global variables in this file, there can be race conditions when accessing it from different hailopython plugins. So avoid the usage of global variables in a python file referenced by hailopython plugin.