Oak-D-Lite not working with official docker container
Thanks for the pointer.
Confirming that I can build image from Dockerfile as-is (from python:3.9-bullseye
) or from ubuntu:20.04
However, if I were to use nvidia/cudagl:11.1.1-devel-ubuntu20.04
or nvidia/cudagl:11.4.2-devel-ubuntu20.04
as the base image and run it with
sudo docker run --rm \
--runtime=nvidia -ti \
--privileged \
-v /dev/bus/usb:/dev/bus/usb \
--device-cgroup-rule='c 189:* rmw' \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
depthai-python-cuda \
python3 /depthai-python/examples/ColorCamera/rgb_preview.py
I will get the following error
Traceback (most recent call last):
File "/depthai-python/examples/ColorCamera/rgb_preview.py", line 24, in <module>
with dai.Device(pipeline) as device:
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
Wonder if you have any pointers why this is the case? Thanks in advance.
One more data point. I tested with nvidia/cuda:11.6.0-devel-ubuntu20.04
and it actually works when I run it with
sudo docker run --rm \
--runtime=nvidia -ti\
--privileged \
-v /dev/bus/usb:/dev/bus/usb \
--device-cgroup-rule='c 189:* rmw' \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
depthai-python-cuda \
python3 /depthai-python/examples/ColorCamera/rgb_preview.py
However, not quite getting why the additional support of OpenGL through libglvnd is causing issues with depthai SDK in nvidia/cudagl:11.4.2-devel-ubuntu20.04
or nvidia/cudagl:11.1.1-devel-ubuntu20.04
.
- Edited
wllui thanks for testing! Maybe nvidia/cudagl has some custom libusb configuration? As it's the only requirement we have, not to use udev when accessing USB devices. And I'm glad it worked with the other image!
Luxonis-Lukasz Anyone tried running docker on MacOS - when I run that command, I get error "Runtime Error: No available devices"
sandeep0101 this will work only on Linux as containers on Windows/Mac run in isolated sandboxes
Luxonis-Lukasz Thanks - so on MacOS, either local install or VirtualBox are the only options?
sandeep0101 yes, although I'd recommend local install - there is a custom configuration needed for VM to correctly recognize the USB devices IIRC
- Edited
Luxonis-Lukasz Thanks - will do local - having screwed my local environment previously many time, I was hoping Docker will save the time for me
PY-Virtual Environment, hopefully will save the day.
sandeep0101 I work on Mac and use built-in venv
and it works great, I'm also on M1 so I have to remember about a few additional steps when working with it
- Edited
Luxonis-Lukasz , you are right. It was due to the existing libusb installed in those images. With minor modifications, I am now able to use these base images without issues. Sharing the Docker file and command here
FROM nvidia/cudagl:11.1.1-devel-ubuntu20.04
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},display
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles
RUN apt-get update && apt-get install -y wget build-essential cmake pkg-config libjpeg-dev libtiff5-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran git python3-pip usbutils
ADD ci/docker_dependencies.sh .
RUN ./docker_dependencies.sh
RUN apt-get remove -y libusb-1.0-0
RUN wget https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2
RUN tar xf libusb-1.0.24.tar.bz2
RUN cd libusb-1.0.24 && \
./configure --disable-udev && \
make -j && make install
RUN pip install -U pip && pip install --extra-index-url https://www.piwheels.org/simple/ --prefer-binary opencv-python
COPY . /depthai-python
RUN cd /depthai-python && python3 -m pip install .
sudo docker run --rm \
--runtime=nvidia -ti\
--privileged \
-v /dev/bus/usb:/dev/bus/usb \
--device-cgroup-rule='c 189:* rmw' \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
depthai-python-cudagl \
python3 /depthai-python/examples/ColorCamera/rgb_preview.py