luxonis / depthai-python

DepthAI Python Library
MIT License
362 stars 192 forks source link

Errors on docker run luxonis/depthai-library:latest #891

Closed gmacario closed 1 year ago

gmacario commented 1 year ago

Hello and many thanks for this wonderful piece of software!

I followed the instructions at https://docs.luxonis.com/projects/api/en/latest/install/#docker and tried to run the Docker image luxonis/depthai-library on a Raspberry Pi 4B connected to a OAK-D Lite (Kickstarter Edition) but I am facing some issues.

I am afraid I missed some details. Thank you in advance for any suggestions!

Testing luxonis/depthai-library on rpi4gm35

Required materials

Step-by-step instructions

(2023-09-12 07:30 CEST)

ssh rpi4gm35

Result:

gianpaolo.macario@HW2457 MINGW64 ~
$ ssh rpi4gm35
Linux rpi4gm35 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 11 15:05:50 2023 from 100.76.148.12
gmacario@rpi4gm35:~ $

Logged in as gmacario@rpi4gm35

uname -a
lsb_release -a
docker --version
sudo dmesg -w

Result:

gmacario@rpi4gm35:~ $ uname -a
Linux rpi4gm35 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
gmacario@rpi4gm35:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
gmacario@rpi4gm35:~ $ docker --version
Docker version 24.0.6, build ed223bc
gmacario@rpi4gm35:~ $ sudo dmesg -w

Now connect the OAK-D Lite to an empty USB-3.0 port of the Raspberry Pi using a PureLink Premium USB v3.2 USB-C / USB-A Cable – 1.00m, Black

...
[1901622.251375] usb 1-1.2: new high-speed USB device number 3 using xhci_hcd
[1901622.356236] usb 1-1.2: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
[1901622.356258] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1901622.356265] usb 1-1.2: Product: Movidius MyriadX
[1901622.356271] usb 1-1.2: Manufacturer: Movidius Ltd.
[1901622.356277] usb 1-1.2: SerialNumber: 03e72485
...

Now testing the command documented in https://docs.luxonis.com/projects/api/en/latest/install/#docker

Pull the image from Docker Hub:

docker pull luxonis/depthai-library

Result:

gmacario@rpi4gm35:~ $ docker pull luxonis/depthai-library
Using default tag: latest
latest: Pulling from luxonis/depthai-library
b04fae59f135: Pull complete
24cef00b9ad9: Pull complete
1db91b65282b: Pull complete
54db3e52d959: Pull complete
4d727a249b44: Pull complete
c3dbbaafce99: Pull complete
0fd9667b9613: Pull complete
8c1418a0d252: Pull complete
942d7ee5ed01: Pull complete
e43eb541dc8a: Pull complete
826e1734ac7f: Pull complete
3502ffd52ffb: Pull complete
f59ae60b1a33: Pull complete
a1b8d8287bc2: Pull complete
ea37cffe7929: Pull complete
5d9843e298fc: Pull complete
Digest: sha256:d620356b039a517e5eb96177ca027bb7525c29b4456df279280eb117d9e38348
Status: Downloaded newer image for luxonis/depthai-library:latest
docker.io/luxonis/depthai-library:latest
gmacario@rpi4gm35:~ $

Now run the container:

docker run --rm \
    --privileged \
    -v /dev/bus/usb:/dev/bus/usb \
    --device-cgroup-rule='c 189:* rmw' \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    luxonis/depthai-library:latest \
    python3 /depthai-python/examples/ColorCamera/rgb_preview.py

Result:

gmacario@rpi4gm35:~ $ docker run --rm \
    --privileged \
    -v /dev/bus/usb:/dev/bus/usb \
    --device-cgroup-rule='c 189:* rmw' \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    luxonis/depthai-library:latest \
    python3 /depthai-python/examples/ColorCamera/rgb_preview.py
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error creating device nodes: open /home/gmacario/.local/share/docker/overlay2/ecc809f0bfdb243578b07ee2e29a056c3038c5918fd05dd3fba289faba0cdf9b/merged/dev/bus/usb/001/001: permission denied: unknown.
gmacario@rpi4gm35:~ $
gmacario commented 1 year ago

I forgot to mention that I am running Raspberry Pi OS Lite 64-bit (bullseye) with no X server running at the moment. I wonder whether this is a supported configuration and if not how could I use the OAK-D-Lite in Docker anyway.

themarpe commented 1 year ago

@gmacario I'd follow https://docs.docker.com/engine/install/ubuntu/ to update docker and then https://docs.docker.com/engine/install/linux-postinstall/ to make sure permissions are set correctly

gmacario commented 1 year ago

@gmacario I'd follow https://docs.docker.com/engine/install/ubuntu/ to update docker and then https://docs.docker.com/engine/install/linux-postinstall/ to make sure permissions are set correctly

Thank you @themarpe for your suggestions.

I made further investigations and tested a different script which does not require a graphical subsystem to run: SystemLogger/system_information.py (source code):

In this case the container runs without problems.

Code:

sudo docker run --rm \
    --privileged \
    -v /dev/bus/usb:/dev/bus/usb \
    --device-cgroup-rule='c 189:* rmw' \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    luxonis/depthai-library:latest \
    python3 /depthai-python/examples/SystemLogger/system_information.py

Result:

gmacario@rpi4gm35:~ $ sudo docker run --rm \
    --privileged \
    -v /dev/bus/usb:/dev/bus/usb \
    --device-cgroup-rule='c 189:* rmw' \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    luxonis/depthai-library:latest \
    python3 /depthai-python/examples/SystemLogger/system_information.py
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.31 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.00, css: 37.71, mss: 34.88, upa: 35.35, dss: 36.06
Cpu usage - Leon CSS: 25.81%, Leon MSS: 1.82 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 35.53, css: 36.30, mss: 35.35, upa: 35.11, dss: 35.35
Cpu usage - Leon CSS: 1.56%, Leon MSS: 3.88 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 35.65, css: 36.06, mss: 34.88, upa: 36.30, dss: 35.35
Cpu usage - Leon CSS: 0.28%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.18, css: 37.01, mss: 36.06, upa: 36.53, dss: 35.11
Cpu usage - Leon CSS: 0.33%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.30, css: 37.01, mss: 35.83, upa: 36.77, dss: 35.59
Cpu usage - Leon CSS: 0.28%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.36, css: 36.77, mss: 37.01, upa: 35.83, dss: 35.83
Cpu usage - Leon CSS: 0.17%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.12, css: 36.77, mss: 36.06, upa: 35.83, dss: 35.83
Cpu usage - Leon CSS: 0.17%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.53, css: 37.01, mss: 36.06, upa: 36.30, dss: 36.77
Cpu usage - Leon CSS: 0.22%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.47, css: 37.71, mss: 36.53, upa: 36.06, dss: 35.59
Cpu usage - Leon CSS: 0.17%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.24, css: 37.01, mss: 35.59, upa: 37.01, dss: 35.35
Cpu usage - Leon CSS: 0.38%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.00, css: 36.06, mss: 36.06, upa: 36.06, dss: 35.83
Cpu usage - Leon CSS: 0.38%, Leon MSS: 0.09 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.30, css: 36.53, mss: 36.30, upa: 36.30, dss: 36.06
Cpu usage - Leon CSS: 0.27%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.71, css: 37.48, mss: 36.30, upa: 36.77, dss: 36.30
Cpu usage - Leon CSS: 0.25%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.83, css: 37.24, mss: 36.53, upa: 36.77, dss: 36.77
Cpu usage - Leon CSS: 0.21%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.36, css: 37.24, mss: 36.06, upa: 36.06, dss: 36.06
Cpu usage - Leon CSS: 0.17%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.77, css: 37.48, mss: 36.30, upa: 36.77, dss: 36.53
Cpu usage - Leon CSS: 0.22%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.71, css: 37.71, mss: 36.06, upa: 36.77, dss: 36.30
Cpu usage - Leon CSS: 0.18%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.59, css: 37.24, mss: 36.30, upa: 36.53, dss: 36.30
Cpu usage - Leon CSS: 0.27%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.41, css: 37.71, mss: 35.83, upa: 35.83, dss: 36.30
Cpu usage - Leon CSS: 0.37%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.89, css: 37.48, mss: 37.48, upa: 36.77, dss: 35.83
Cpu usage - Leon CSS: 0.38%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.89, css: 37.71, mss: 37.01, upa: 36.77, dss: 36.06
Cpu usage - Leon CSS: 0.23%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.89, css: 37.48, mss: 36.53, upa: 37.01, dss: 36.53
Cpu usage - Leon CSS: 0.22%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.65, css: 37.24, mss: 36.53, upa: 36.53, dss: 36.30
Cpu usage - Leon CSS: 0.17%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.77, css: 37.48, mss: 36.06, upa: 37.01, dss: 36.53
Cpu usage - Leon CSS: 0.17%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.77, css: 37.71, mss: 36.77, upa: 36.77, dss: 35.83
^CCpu usage - Leon CSS: 0.22%, Leon MSS: 0.08 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.83, css: 37.48, mss: 36.77, upa: 36.53, dss: 36.53
Cpu usage - Leon CSS: 0.27%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.83, css: 37.24, mss: 36.53, upa: 37.01, dss: 36.53
Cpu usage - Leon CSS: 0.32%, Leon MSS: 0.07 %
----------------------------------------
Ddr used / total - 0.13 / 337.18 MiB
Cmx used / total - 2.07 / 2.50 MiB
LeonCss heap used / total - 8.56 / 80.03 MiB
LeonMss heap used / total - 2.93 / 41.06 MiB
Chip temperature - average: 36.77, css: 37.24, mss: 36.06, upa: 37.01, dss: 36.77
Cpu usage - Leon CSS: 0.38%, Leon MSS: 0.08 %
----------------------------------------
Traceback (most recent call last):
  File "/depthai-python/examples/SystemLogger/system_information.py", line 39, in <module>
    sysInfo = qSysInfo.get()  # Blocking call, will wait until a new data has arrived
KeyboardInterrupt
gmacario@rpi4gm35:~ $

This makes me feel that the suspicion I had in https://github.com/luxonis/depthai-python/issues/891#issuecomment-1715051101 is confirmed.

The error which I mentioned in https://github.com/luxonis/depthai-python/issues/891#issue-1891741271 might be raised because the script attempts to initialize the graphic subsystem, but in my case the Docker host is running ubuntu-server and no X server is running.

Unfortunately the error returned by docker run was a little bit vague therefore I did not associate it to the dependency on X.

Closing issue, sorry for the noise.