manual docker install for gstreamer

Hey team,

I’m trying to setup Hailo on a docker container, for a robotics/ros2 project. My plan is to use a gst pipeline to stream the usb camera to a tcpsink, then inside the container consumer from that tcp, run inference, then pipe to another tcpsink that the host can get the output.

Host On my host machine (rpi5 running ubuntu), I have setup the hailo drivers and can see the device is registered with hailortcli fw-control identify

Docker This is my Dockerfile

`FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

— Install Python 3.11 and pip —

RUN apt-get update &&
apt-get install -y python3.11 python3.11-venv python3.11-dev python3-pip &&
ln -sf /usr/bin/python3.11 /usr/bin/python &&
ln -sf /usr/bin/python3.11 /usr/bin/python3

— Install all dependencies (build tools, gstreamer, opencv, etc) —

RUN apt-get update && apt-get install -y
sudo unzip curl wget build-essential lsb-release
python3-dev python3-setuptools python3-gi python3-gi-cairo python3-opencv python3-virtualenv
libgirepository1.0-dev python-gi-dev libcairo2-dev
libopencv-dev libzmq3-dev
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x
gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5
gstreamer1.0-pulseaudio rsync ffmpeg x11-utils vim
gcc-12 g+±12 cmake git
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libffi-dev
liblzma-dev libncurses5-dev libgdbm-dev tk-dev uuid-dev libnss3-dev
&& apt-get clean && rm -rf /var/lib/apt/lists/*

— Copy in setup files (models, debs, etc) —

COPY ./setup /tmp/setup

— Extract HailoRT runtime (change to _arm64.deb for ARM!) —

RUN mkdir -p /opt/hailo

— Environment for runtime —

ENV LD_LIBRARY_PATH=/opt/hailo/usr/lib
ENV PATH=$PATH:/opt/hailo/usr/bin
ENV CPLUS_INCLUDE_PATH=/opt/hailo/usr/include:/opt/hailo/usr/include/gstreamer-1.0/gst/hailo

WORKDIR /workspace

Optionally, copy in your models, .so files, test data, etc.

COPY ./models /workspace/models

COPY ./so /workspace/so

— Expose GStreamer ports —

EXPOSE 5000
EXPOSE 5001

Automate the install of some libs that need a running system to install

COPY setup/entrypoint-manual-install.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT [“/usr/local/bin/entrypoint.sh”]

CMD [“/bin/sh”, “-c”, “bash”]`

I’m using the entrypoint as a way to install the deb once the system is up, I saw on another post that you can’t do this as part of the docker build

`#!/bin/bash
set -e

export DEBIAN_FRONTEND=noninteractive

Optional: create state dir

mkdir -p /var/lib/hailo

Check if Hailo is installed

if ! dpkg -s hailort >/dev/null 2>&1; then
apt-get update

echo “:package: Installing Hailo-all”

— Extract HailoRT runtime (change to _arm64.deb for ARM!) —

dpkg-deb -x /tmp/setup/hailort_4.20.0_arm64.deb /opt/hailo

ln -s /opt/hailo/usr/bin/hailortcli /usr/bin/hailortcli && ln -s /opt/hailo/usr/lib/libhailort.so.4.20.0 /usr/lib/libhailort.so

— Unzip and install Tappas (3.31.0) —

unzip /tmp/setup/tappas_3.31.0_linux_installer.zip -d /tmp
cd /tmp/tappas_v3.31.0
mkdir hailort
git clone GitHub - hailo-ai/hailort: An open source light-weight and high performance inference framework for Hailo devices hailort/sources
chmod +x install.sh

the help for install says to use aarch64 but it’s wrong, it’ll fail on a sub script, use arm

./install.sh --skip-hailort --target-platform arm

echo “:white_check_mark: Hailo installation complete”
else
echo “:white_check_mark: Hailo already installed”
fi

Clear bash command cache to ensure new tools like hailortcli are found

hash -r

Pass control to CMD

exec “$@”
`

I downloaded hailort_4.20.0_arm64.deb and tappas_3.31.0_linux_installer.zip from the developer area on the Hailo website.

When I check for the hailonet plugin, it’s not installed

gst-inspect-1.0 hailonet
No such element or plugin 'hailonet'

However hailooverlay and hailofilter are present. Other than the hailort deb, and tappas linux installer, what else do I need to install?

thanks

Hey @james_elsey,

Welcome to the Hailo Community!

I’d recommend using this installation script: hailo-apps-infra/scripts/hailo_installer.sh at main · hailo-ai/hailo-apps-infra · GitHub

You’ll also need to install the driver separately. I’d suggest going with the tappas-core installation as well - it should give you a more stable setup.

Let me know if you run into any issues during the installation process!

Hi Omria, thanks for the reply.

I’m a little confused by all the different components, can you please help me understand?

I checked the hailo-apps-infra script you linked, and I see in the comments at the top it says:

#   - Downloads and installs the following:
#       * HailoRT driver deb
#       * HailoRT deb
#       * Tapas core deb
#       * HailoRT Python bindings whl
#       * Tapas core Python bindings whl

Does this mean that I don’t need to be installing the hailort deb and tappas linux installer in my container (as I posted above), I can drop those 2 lines and just run this script?

Thanks
James

@omria

I couldn’t install the hailo-apps-infra, it complains that the driver is missing

Failed. Exited with status 2. See /var/log/hailort-pcie-driver.deb.log
dpkg: error processing package hailort-pcie-driver (--configure):
 installed hailort-pcie-driver package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 hailort-pcie-driver
E: Sub-process /usr/bin/dpkg returned an error code (1)

The driver is already installed on the host, I don’t think the container should need it, looking at the example from Canonical, they just install the pcie driver on the host and make /sys and /dev available to the container

I tried checking out hailort-drivers and running make all from the linux/pcie directory, but get this error

make[1]: *** /lib/modules/6.8.0-1030-raspi//build: No such file or directory.  Stop.
make: *** [Makefile:93: all] Error 2

I’ve tried every install script I can find, but I’m getting lost amongst them, has anyone been able to get this working?

I was able to get over this issue by being explicit with versions, I took the example from Canonical but had to do this

# checkout the latest stable version
git clone https://github.com/hailo-ai/hailort-drivers.git
git checkout v4.20.0

Then, inside my containers entrypoint script, I tied the libs to these versions

  echo "📦 Installing Hailo-all"
  apt-get update && \
    apt-get install -y \
        hailo-all=4.20.0 \
        hailo-tappas-core=3.31.0+1-1 \
        hailofw=4.20.0-1 \
        hailort=4.20.0-1 \
        python3-hailort=4.20.0-1 \
        rpicam-apps-hailo-postprocess=1.7.0-1 \
    && apt-mark hold hailo-all hailo-tappas-core hailofw hailort python3-hailort rpicam-apps-hailo-postprocess

That seems to be all I needed to do so far, I can now see the hailonet, hailooverlay and hailofilter gstreamer elements.

I had a few red-herrings that took me down a dark path… on the host it would randomly “lose” the device, especially after a reboot, but I found another post on here saying to run hailortcli scan, then if devices have vanished, run

sudo modprobe -r hailo_pci
sudo modprobe hailo_pci

I’m going in a slightly different direction than the Canonical example, I’m using the container headless, it’ll just do the inferrence, it’ll be a gstreamer pipeline sourcing from one tcp and sinking to another tcp outside the container. When I eventually get it working I’ll come back here with some links

1 Like