No module named 'hailo'

Hi.
I did sudo apt update and sudo apt full-upgrade
sudo apt install hailo-all
reboot
git clone GitHub - hailo-ai/hailo-rpi5-examples
cd hailo-rpi5-examples
source setup_env.sh
pip install -r requirements.txt
./download_resources.sh

all ok till here but when i do : python basic_pipelines/detection.py --input resources/detection0.mp4
i’m getting : “detection.py”, line 12, in
import hailo
ModuleNotFoundError: No module named ‘hailo’
"
Need some help guys plz
S.

Hey @oposum2012

Can you run

hailortcli fw-control identify

To check if you have it installed correctly

yep: (base) pi@raspberrypi:~ $ hailortcli fw-control identify
Executing on device: 0000:03:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.17.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB244901737
Part Number: HM22LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP

also did : (base) pi@raspberrypi:~ $ gst-inspect-1.0 hailo
Plugin Details:
Name hailo
Description hailo gstreamer plugin
Filename /lib/aarch64-linux-gnu/gstreamer-1.0/libgsthailo.so
Version 1.0
License unknown
Source module hailo
Binary package GStreamer
Origin URL http://gstreamer.net/

hailodevicestats: hailodevicestats element
hailonet: hailonet element
synchailonet: sync hailonet element

3 features:
±- 3 elements

and this : (base) pi@raspberrypi:~ $ gst-inspect-1.0 hailotools
Plugin Details:
Name hailotools
Description hailo tools plugin
Filename /lib/aarch64-linux-gnu/gstreamer-1.0/libgsthailotools.so
Version 3.28.2
License unknown
Source module gst-hailo-tools
Binary package gst-hailo-tools
Origin URL https://hailo.ai/

hailoaggregator: hailoaggregator - Cascading
hailocounter: hailocounter - postprocessing element
hailocropper: hailocropper
hailoexportfile: hailoexportfile - export element
hailoexportzmq: hailoexportzmq - export element
hailofilter: hailofilter - postprocessing element
hailogallery: Hailo gallery element
hailograytonv12: hailograytonv12 - postprocessing element
hailoimportzmq: hailoimportzmq - import element
hailomuxer: Muxer pipeline merging
hailonv12togray: hailonv12togray - postprocessing element
hailonvalve: HailoNValve element

Did you run source setup_env.sh on the repository root folder to activate the python virtual environment first? Try running that then the python basic_pipelines/detection.py --input resources/detection0.mp4

ofc I did. i posted that in first message. there is a list of what i did one after another. no errors. Strangly when i open detection.py in Geany and run (i know it’s without parameters but i just want to know where it breaks) it stops at line 8 : Traceback (most recent call last):
File “/home/pi/Desktop/AI/AIKIT/hailo-rpi5-examples/basic_pipelines/detection.py”, line 8, in
import setproctitle
ModuleNotFoundError: No module named ‘setproctitle’

Import Hailo is on line 12 and code looks like this : import gi
gi.require_version(‘Gst’, ‘1.0’)
from gi.repository import Gst, GLib
import os
import argparse
import multiprocessing
import numpy as np
import setproctitle
import cv2
import time

import hailo

so i’m moving import hailo on line 1 to see if it will die at import hailo . so code before execution looks like this :

import hailo
import gi
gi.require_version(‘Gst’, ‘1.0’)
from gi.repository import Gst, GLib
import os
import argparse
import multiprocessing
import numpy as np
import setproctitle
import cv2
import time

but on execute i have : Traceback (most recent call last):
File “/home/pi/Desktop/AI/AIKIT/hailo-rpi5-examples/basic_pipelines/detection.py”, line 9, in
import setproctitle
ModuleNotFoundError: No module named ‘setproctitle’

so hailo was visible … i do not understand what is going on

Hi Please make sure your are in the correct virtualenv.
The example virtual environment should be called venv_hailo_rpi5_examples in your description it looks like you are running inside a base virtualenv (or Conda)
Please deactivate your current virtualenv and rerun the installation from the RPi default python. Hailo dependencies are installed to this python and the virtualenv inherits it using the --system-site-packages flag.

i’m in venv : (venv_hailo_rpi5_examples) (base) pi@raspberrypi:~/Desktop/AI/AIKIT/hailo-rpi5-examples $ python basic_pipelines/detection.py --input resources/detection0.mp4
Traceback (most recent call last):
File “/home/pi/Desktop/AI/AIKIT/hailo-rpi5-examples/basic_pipelines/detection.py”, line 1, in
import hailo
ModuleNotFoundError: No module named ‘hailo’

here is video just to see with your own eyes : https://www.youtube.com/watch?v=IG49mfNuJ7Q

The hailo package is install to system python. Not in any venv or conda env.

You check it by import hailo on system default python. Not in any conda or venv

So when create env via venv ,you need add -system-site-packages args. Then the venv will include system package.

I don’t know how conda can use system python package.

Also your venv or conda python version need the same as system python. In raspi 5 should be 3.11. If python version different , the hailo package wouldn’t included.

what you say is that i do not need to have (base) there ? like this could be the problem why it’s messing my stuff ?

(base) what I know should be conda default env , this does not include any system python package.

The problem is “sudo apt install hailo-all”, is install in your system python package.

What you need to is include the system python package to your venv or conda env. But I don’t know how can be done in conda.
If you use venv direactly , it is simple just create your env with --system-site-packages.

If you can find a method to include system-site-packages to conda (base) env, then the problem should be gone.

When you in (base) to create any new venv with --system-site-packages will include (base) as the base python package, not system python package.

1 Like

understood. i’ll try. thank you

it works now. thank you !!!