luxonis / depthai-viewer

Log images, point clouds, etc, and visualize them effortlessly. Built in Rust using egui
https://rerun.io
Apache License 2.0
27 stars 2 forks source link

Failed to create wgpu adapter #63

Open pomelo925 opened 3 months ago

pomelo925 commented 3 months ago

Hi, I encountered an error message "failed to create wgpu" when attempting to open depthai-viewer within a Docker container on Ubuntu 20.04.

The operating environment is Windows locally connected to an Ubuntu 22.04 host via SSH. I can successfully open other GUI interfaces in this container (including ColorCamera/rgb_preview.py from luxonis/depthai-python.git), so the camera and display settings should be fine.

All prerequisites have been installed and python3 --version: Python 3.8.10. Camera: Oak-D


Here is the specific error message:

root@ttennis:~# python3 -m depthai_viewer [2024-06-09T20:48:54Z INFO winit::platform_impl::platform::x11::window] Guessed window scale factor: 1 [2024-06-09T20:48:55Z WARN wgpu_hal::vulkan::instance] create_instance: ERROR_INCOMPATIBLE_DRIVER [2024-06-09T20:48:55Z ERROR eframe::native::run] Exiting because of error: Wgpu(NoSuitableAdapterFound) on event Resumed Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.8/dist-packages/depthai_viewer/main.py", line 31, in main() File "/usr/local/lib/python3.8/dist-packages/depthai_viewer/main.py", line 27, in main sys.exit(bindings.main(sys.argv, python_exe, site_packages_directory)) RuntimeError: WGPU error: Failed to create wgpu adapter, no suitable adapter found. -> Failed to create wgpu adapter, no suitable adapter found.

zrezke commented 3 months ago

Hi! it will be quite hard to debug this, Could you post the exact commands you are using . .. So:

pomelo925 commented 3 months ago

tks for reply, and yeh im working in a relatively complex environment.

I SSH into the Ubuntu 22.04 host with MobaXTerm (to simply enable X11 Forwarding & no further operations after connection ) and VSCode (to edit code, start/remove container ... etc) simultaneously. I think what MobaXTerm does is basically equivalent to the -X terminal command.


Here's the configuration of docker-compose.yml:

services:
  EdgeNN:
    image: pomelo925/ttennis-humble:edgenn
    container_name: edgenn-run
    tty: true
    network_mode: host
    privileged: true

    volumes:
      - /dev/bus/usb:/dev/bus/usb
      - /tmp/.X11-unix:/tmp/.X11-unix
      - $HOME/.Xauthority:/root/.Xauthority

    environment:
      - DISPLAY=${DISPLAY}

    devices:
      - /dev/bus/usb  

    # command: >
      # /bin/bash -c "depthai-viewer"

and also the complete Dockerfile:

## AMD64 architecture ##
FROM osrf/ros:noetic-desktop-full

LABEL org.opencontainers.image.authors="yoseph.huang@gmail.com"

ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID

##########################
## create non-root user
##########################
RUN groupadd --gid $USER_GID $USERNAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
    ## passwordless
    && apt-get update \
    && apt-get install -y sudo \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    && rm -rf /var/lib/apt/lists/*

##########################
## pkgs installation
##########################
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    net-tools ssh nano git usbutils x11-apps apt-utils udev \
    && rm -rf /var/lib/apt/lists/*d

##########################
## Depth-AI
##########################
RUN git clone https://github.com/luxonis/depthai-core.git && \
    cd depthai-core && \
    git submodule update --init --recursive && \
    rm -rf .git

WORKDIR /depthai-core/build
RUN cmake .. && \ 
    cmake --build . --parallel $(nproc) && \
    cmake --install . --prefix /usr/local && \
    cd .. && cmake -S. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON' && \
    cmake --build build

##########################
## Depth-AI Viewer
##########################
RUN sudo apt-get update && sudo apt-get install -y \
    libclang-dev libatk-bridge2.0 libfontconfig1-dev \
    libfreetype6-dev libglib2.0-dev libgtk-3-dev \
    libssl-dev libxcb-render0-dev libxcb-shape0-dev \
    libxcb-xfixes0-dev libxkbcommon-dev patchelf \
    python3-pip python-is-python3 

RUN python3 -m pip install --upgrade pip \
    && python3 -m pip install depthai-viewer \
    && echo 'export PATH=$PATH:/home/user/.local/bin' >> ~/.bashrc

##########################
## Final Touch
##########################
# USER $USERNAME
ENV SHELL /bin/bash
CMD ["/bin/bash"]