Failed to load module: No module named 'console'

My docker image runs everything correctly. It has access to my display. It manages to run xclock, which is apparently a community hacky test to see if the display is correctly connected, and mine is. It manages to build the vehicle binaries. Manages to run python3. All is good. However, I get these errors:

RiTW: Window access not found
Failed to load module: No module named 'console'. 
Use 'set moddebug 3' in the MAVProxy console to enable traceback
Failed to load module: No module named 'map'. 
Use 'set moddebug 3' in the MAVProxy console to enable traceback

Helping me solve any of these three errors will be of serious help!

STEPS TO REPRODUCE:

docker pull drnic/ardupilot-sitl
docker run -it \
  -v /tmp/.X11-unix:/tmp/.X11-unix \ 
  -e DISPLAY=$DISPLAY \
  -h $HOSTNAME \
  -v $HOME/.Xauthority:/ardupilot/.Xauthority \
  drnic/ardupilot-sitl bash

And inside of it, I installed python3, pip3, mavproxy, pymavlink.

Then I run the following

cd ardupilot
Tools/autotest/sim_vehicle.py -v ArduPlane --map --console

And I am running Ubuntu 22.04. with docker (does the version matter?)

But to no avail. Those bloody errors get in the way everytime! I want my map and my console!

Thank you in advance.

@khancyr @drnic, you guys have written a lot about these docker topics, hopefully you’ll overlook me tagging you two!

Did you try this on mavproxy to see if a dependency was missing ?
I don’t know anything about this docker image so I won’t be any help here

I’ll try it, and let you know :smiley:

Would it be helpful if I sent my Dockerfile that has the same exact errors? Would it help?

Hey, so here’s the Dockerfile that gets the same exact error! So, can you tell me what am I missing in it? What will allow me to get the ‘map’, ‘console’, and other modules?

Run command:

docker run -it \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -e DISPLAY=$DISPLAY \
  -h $HOSTNAME \
  -v $HOME/.Xauthority:/ardupilot/.Xauthority \
  ardupilot-no-gazebo \
  bash

Dockerfile:

# FROM python:3.9-slim AS builder
FROM ubuntu:20.04 AS builder
ARG DEBIAN_FRONTEND=noninteractive
ARG USER_NAME=ardupilot
ARG USER_UID=1000
ARG USER_GID=1000
ARG SKIP_AP_EXT_ENV=1
ARG SKIP_AP_GRAPHIC_ENV=1
ARG SKIP_AP_COV_ENV=1
ARG SKIP_AP_GIT_CHECK=1

# Make my user
# RUN groupadd -g 1000 $USER_NAME
# RUN useradd -d $HOME -s /bin/bash -m $USER_NAME -u 1000 -g 1000 \
#         && echo $USER_NAME:ubuntu | chpasswd \
#         && adduser $USER_NAME sudo
RUN groupadd ${USER_NAME} --gid ${USER_GID}
RUN useradd -l -m ${USER_NAME} -u ${USER_UID} -g ${USER_GID} -s /bin/bash

################################################################################
### Install minimal build tools and remove cache. Don't do any update

RUN apt-get update && apt-get install --no-install-recommends -y \
    g++ \
    git \
    sudo \
    curl \
    apt-utils \
    x11-apps \
    libxml2-dev \
    libxslt-dev \
    lsb-release \
    tzdata \
    bash-completion \
    python3 \
    python3-pip \
    libopencv-dev \
    python3-opencv \
    && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN sudo pip3 install --user --no-deps --no-cache-dir future empy pexpect ptyprocess

# Clone not simplified, you get everything in here
RUN git clone --recursive https://github.com/ardupilot/ardupilot.git

#########################################
### Running install-prereqs-ubuntu.sh ###
# Create non root user for pip
ENV USER=${USER_NAME}

RUN echo "ardupilot ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME}
RUN chmod 0440 /etc/sudoers.d/${USER_NAME}
RUN find /ardupilot -type d ! -path "/ardupilot/modules" -exec chown ${USER_NAME}:${USER_NAME} {} \;

USER ${USER_NAME}
ENV SKIP_AP_EXT_ENV=$SKIP_AP_EXT_ENV SKIP_AP_GRAPHIC_ENV=$SKIP_AP_GRAPHIC_ENV SKIP_AP_COV_ENV=$SKIP_AP_COV_ENV SKIP_AP_GIT_CHECK=$SKIP_AP_GIT_CHECK

WORKDIR /ardupilot
RUN Tools/environment_install/install-prereqs-ubuntu.sh -y
RUN . ~/.profile
### Ending install-prereqs-ubuntu.sh ###
########################################

# Build binary
WORKDIR /ardupilot
RUN ./waf configure --board sitl --no-submodule-update
RUN ./waf plane

# apparently, mavproxy is not installed in install-prereqs-ubuntu.sh :(
RUN sudo pip3 install -U pymavlink MAVProxy

# FROM python:3.9-slim
# copy only the dependencies installation from the 1st stage image
# COPY --from=builder /root/.local /root/.local

# Copy binary and defaut param file from previous image
# COPY --from=builder /ardupilot/src/build/sitl/bin/arduplane .
# COPY --from=builder /ardupilot/src/Tools/autotest/default_params/plane.parm .

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1

COPY sitl_launch.bash /bin/sitl_launch.bash
# SITL 1
EXPOSE 5760/tcp
EXPOSE 5762/tcp
EXPOSE 5763/tcp
EXPOSE 5501
# SITL 2
EXPOSE 5770/tcp
EXPOSE 5772/tcp
EXPOSE 5773/tcp
EXPOSE 5511
# SITL 3
EXPOSE 5780/tcp
EXPOSE 5782/tcp
EXPOSE 5783/tcp
EXPOSE 5521

# Multicast
EXPOSE 14550/tcp
EXPOSE 14550/udp

# ENTRYPOINT ["sitl_launch.bash"]
CMD ["bash"]

You’ll notice that most if it is actually inspired by your Dockerfiles, but I tweaked it a bit. Hopefully incorrectly and hopefully you’ll be able to see why.

I tried running it like this:

ardupilot@ibrahim-ThinkCentre-M70t:/ardupilot$ mavproxy.py --map --console
Auto-detected serial ports are:
Connect 0.0.0.0:14550 source_system=255
Failed to load module: No module named 'console'. Use 'set moddebug 3' in the MAVProxy console to enable traceback
Failed to load module: No module named 'map'. Use 'set moddebug 3' in the MAVProxy console to enable traceback
Log Directory: 
Telemetry log: mav.tlog
Waiting for heartbeat from 0.0.0.0:14550
MAV> link 1 down
set moddebug 3 <---- me trying to set the mod to debug
MAV> module load map <---- me trying to load the map
MAV> No module named 'wx'
Traceback (most recent call last):
  File "/usr/local/bin/mavproxy.py", line 374, in load_module
    module = m.init(mpstate, **kwargs)
  File "/home/ardupilot/.local/lib/python3.8/site-packages/MAVProxy/modules/mavproxy_map/__init__.py", line 1111, in init
    return MapModule(mpstate)
  File "/home/ardupilot/.local/lib/python3.8/site-packages/MAVProxy/modules/mavproxy_map/__init__.py", line 68, in __init__
    from MAVProxy.modules.mavproxy_map import mp_slipmap
  File "/home/ardupilot/.local/lib/python3.8/site-packages/MAVProxy/modules/mavproxy_map/mp_slipmap.py", line 19, in <module>
    from MAVProxy.modules.lib import win_layout
  File "/home/ardupilot/.local/lib/python3.8/site-packages/MAVProxy/modules/lib/win_layout.py", line 4, in <module>
    import os, wx, pickle
ModuleNotFoundError: No module named 'wx'

No module named 'map'
Traceback (most recent call last):
  File "/usr/local/bin/mavproxy.py", line 689, in import_package
    mod = __import__(name)
ModuleNotFoundError: No module named 'map'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/mavproxy.py", line 372, in load_module
    m = import_package(modpath)
  File "/usr/local/bin/mavproxy.py", line 692, in import_package
    mod = __import__(name)
ModuleNotFoundError: No module named 'map'

Failed to load module: No module named 'map'.

Is this helpful? I imagine that the next step spelled itself out, and that’s to get the wx module (somehow), but like, I was searching for it, and couldn’t find anything on it (yet). If you by any chance know, lemme know :face_in_clouds:

SOLUTION:

sudo apt-get install python3-wxgtk4.0 -y --no-install-recommends

Why? the --no-install-recommends flag was the key. This library is apparently suggesting a lot of unnecessary packages that the docker image simply doesn’t need (or cannot even support).

2 Likes

thank you so much for your help!!

1 Like