Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Qt error in Docker with Mayavi Application
Forum Updated to NodeBB v4.3 + New Features

Qt error in Docker with Mayavi Application

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 3 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheLoneliestMonk
    wrote on last edited by
    #1

    The goal: Create a Docker container to implement a Mayavi based application. The application should accept data points and create a 3d image. Th GUI portion of Mayavi is not absolutely necessary, however is used when the application runs.

    The Docker image is created with the following:

    FROM python:3.7
    
    ENV QT_DEBUG_PLUGINS=1
    ENV QT_GRAPHICSSYSTEM="native"
    ENV QT_X11_NO_MITSHM=1
    
    RUN mkdir /src
    WORKDIR /src
    
    RUN apt-get update && apt-get install -y \
        libgl1-mesa-dev \
        libqt5x11extras5 \
        libxkbcommon-x11-0 \
        libxcb-randr0-dev \
        libxcb-xtest0-dev \
        libxcb-xinerama0-dev \
        libxcb-shape0-dev \
        libxcb-xkb-dev \
        locate
    
    RUN python3 -m pip install numpy==1.18.1 \
        && python3 -m pip install vtk==8.1.2 \
        && python3 -m pip install mayavi==4.7.1 \
        && python3 -m pip install pyqt5==5.14.0 
    
    COPY my_funny_app.py .
    
    CMD ["python3.7", "my_funny_app.py"]
    

    The container is created without incident. When the container is run the following error is received:

    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/bin/platforms" ...
    loaded library "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so"
    qt.qpa.xcb: could not connect to display 
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
    

    Any ideas on how to solve this problem?

    PS: Read about needing to connect a container to a host's X server for display. If this is indeed the case what is the solution for unknown host such as an Amazon instance?

    jsulmJ 1 Reply Last reply
    0
    • T TheLoneliestMonk

      The goal: Create a Docker container to implement a Mayavi based application. The application should accept data points and create a 3d image. Th GUI portion of Mayavi is not absolutely necessary, however is used when the application runs.

      The Docker image is created with the following:

      FROM python:3.7
      
      ENV QT_DEBUG_PLUGINS=1
      ENV QT_GRAPHICSSYSTEM="native"
      ENV QT_X11_NO_MITSHM=1
      
      RUN mkdir /src
      WORKDIR /src
      
      RUN apt-get update && apt-get install -y \
          libgl1-mesa-dev \
          libqt5x11extras5 \
          libxkbcommon-x11-0 \
          libxcb-randr0-dev \
          libxcb-xtest0-dev \
          libxcb-xinerama0-dev \
          libxcb-shape0-dev \
          libxcb-xkb-dev \
          locate
      
      RUN python3 -m pip install numpy==1.18.1 \
          && python3 -m pip install vtk==8.1.2 \
          && python3 -m pip install mayavi==4.7.1 \
          && python3 -m pip install pyqt5==5.14.0 
      
      COPY my_funny_app.py .
      
      CMD ["python3.7", "my_funny_app.py"]
      

      The container is created without incident. When the container is run the following error is received:

      Got keys from plugin meta data ("xcb")
      QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/bin/platforms" ...
      loaded library "/usr/local/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so"
      qt.qpa.xcb: could not connect to display 
      qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
      This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
      
      Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
      

      Any ideas on how to solve this problem?

      PS: Read about needing to connect a container to a host's X server for display. If this is indeed the case what is the solution for unknown host such as an Amazon instance?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @TheLoneliestMonk said in Qt error in Docker with Mayavi Application:

      qt.qpa.xcb: could not connect to display

      Looks like there is no X11 running, but I'm not a Docker expert.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Eric Larson
        wrote on last edited by
        #3

        Perhaps you could use xvfb or xvfb-run, these are common solutions at least in CIs

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved