Unable to install librealsense for Raspberry Pi4 Ubuntu Xenial

Thanks for connecting @rosswesleyporter ! Here’s some answers:

Background: I’m using balena-cam as template and created a file test_server.py to test out librealsense and opencv imports to deploy an app on the Raspberry Pi.

  • Yes. The build process DOES give me a /build/python/ does not exist. In earlier docker files when I’ve tried to use ‘COPY’ or 'RUN cp -r ’ to copy those .so files into the root for my project app to import. I get a file does not exist in the build and it errors out.
  • I do see the librealsense .so files from my project in my container. They are part of the project because locally we use those .so files to import pyrealsense2 as well. My current estimate is that those pre built .so files are not getting imported because they were generated with a different python version.
  • Here’s some librealsense instructions which have worked for us in the past:

The following is my latest dockerfile code:

FROM balenalib/raspberrypi3-ubuntu:xenial-build

RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y

RUN apt-get install -y python3 \
    python3-dev \
    python3-pip \
    python3-setuptools 

RUN apt-get install -y git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev cmake libglfw3-dev build-essential
RUN git clone https://github.com/IntelRealSense/librealsense.git
RUN cd librealsense/ && ./scripts/setup_udev_rules.sh
RUN mkdir build &&\
    cd build &&\
    cmake /librealsense/ -DBUILD_PYTHON_BINDINGS=true -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false -DCMAKE_BUILD_TYPE=Release &&\
    make -j4 &&\
    make install

ENV LD_LIBRARY_PATH="/usr/local/lib"
# RUN export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# COPY --from=buildrs /usr/src/usr/local /usr/local
# COPY /usr/src/librs /usr/src/app
# COPY librealsense/build/ /usr/src/app/

# COPY /librealsense/build/ /usr/src/app/
#switch on systemd init system in container

ENV INITSYSTEM on

# COPY /usr/src/librs/usr/local /usr/src/app/

WORKDIR /usr/src/app
COPY ./app/ /usr/src/app/


CMD ["python3", "/usr/src/app/test_server.py"]