Could not load the Qt platform plugin "xcb" in "" even though it was found

Hey there,

I am trying to get FlatCAM into an AppImage and I’m facing some problems.

First I tried to install the stable version 8.5, but there I ran into issues with the python versions.

Now I use the current beta 8.994 and trie to stick as close as possible to the appimage-builder docs following the example of an python qt application.

I use appimage-builder and build process exits successfully. However when I start the AppImage i get:

./FlatCAM-8.994-x86_64.AppImage
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.

fish: “./FlatCAM-8.994-x86_64.AppImage” terminated by signal SIGABRT (Abbruch)

Here is my AppImageBuilder.yml:

version: 1

script:
  # Clear AppDir
  - rm -Rf AppDir | true
  # Make usr and icons dirs
  - mkdir -p AppDir/usr/src
  # Copy the python application code into the AppDir
  - cp FlatCAM_beta_Download/  AppDir/usr/src/FlatCAM -r
  # Install application dependencies from setup_ubuntu.sh
  # - PYTHONUSERBASE=AppDir/usr easy_install -U distribute
  # - python3 -m pip install --ignore-installed --prefix=/usr --root=AppDir pip numpy shapely rtree tk lxml cycler python-dateutil kiwisolver dill vispy pyopengl setuptools svg.path ortools freetype-py fontTools rasterio matplotlib qrcode pyqt5 reportlab svglib 'ezdxf>=0.14,<0.15' pyserial
# Copy Icons
  - mkdir -p AppDir/usr/share/icons/256x256/
  - cp FlatCAM_beta_Download/assets/resources/flatcam_icon256.png AppDir/usr/share/icons/256x256/

AppDir:  
  path: ./AppDir

  app_info:
    id: org.tijuca.flatcam
    name: FlatCAM
    icon: flatcam_icon256
    version: '8.994'
    exec: /usr/bin/python3
    exec_args: "$APPDIR/usr/src/FlatCAM/FlatCAM.py $@"

  apt:
    arch: amd64
    sources:
      - sourceline: 'deb [arch=amd64] http://deb.debian.org/debian/ buster main'
        key_url: 'https://ftp-master.debian.org/keys/archive-key-10.asc'

    include:
      # From setup_ubuntu.sh
      - libfreetype6 libfreetype6-dev
      - libgeos-dev
      - libspatialindex-dev
      - libpng-dev
      - qt5-style-plugins
      - python3-dev
      - python3-gdal
      - python3-simplejson
      - python3-pyqt5
      - python3-pyqt5.qtopengl
      - python3-pip
      - python3-tk
      - python3
      - libxcb1


  after_bundle: |
    # Set python 3.7 env
    export PYTHONHOME=${APPDIR}/usr
    export PYTHONPATH=${APPDIR}/usr/lib/python3.7/site-packages:$APPDIR/usr/lib/python3.7
    export PATH=${APPDIR}/usr/bin:$PATH
    # Set python 3.7 as default
    ln -fs python3.7 $APPDIR/usr/bin/python3
    # Install pip
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3.7 get-pip.py
    # Install pipenv
    python3.7 -m pip install pipenv
    # Install application dependencies in AppDir
    python3.7 -m pip install --upgrade --isolated --no-input --ignore-installed --prefix=$APPDIR/usr pip numpy shapely rtree tk lxml cycler python-dateutil kiwisolver dill vispy pyopengl setuptools svg.path ortools freetype-py fontTools rasterio matplotlib qrcode pyqt5 reportlab svglib 'ezdxf>=0.14,<0.15' pyserial

  runtime:
    env:
      # Set python home
      # See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME
      PYTHONHOME: '${APPDIR}/usr'
      # Path to the site-packages dir or other modules dirs
      # See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH
      PYTHONPATH: '${APPDIR}/usr/lib/python3.7/site-packages'
      #PYTHONPATH: '${APPDIR}/usr/lib/python2.7/dist-packages'

#  test:
#    centos:
#      image: appimage-builder/test-env:centos-7
#      command: "./AppRun -c \"ls\""
#      use_host_x: True


AppImage:
  update-information: None
  sign-key: None
  arch: x86_64

I’m a newbie in creating Appimages so every little help is welcome!
Best regards
Samuel

Hello, please request an officially made and supported AppImage from the FlatCAM author, Juan Pablo Caram. Thanks.

Okay.

I did:

I recieve the same error message as in the title, but while attempting to run an AppImage application

Which application? Can you try an AppImage of another Qt-based application (e.g., Krita) and see whether that works? If yes, then it is an issue of the particular application’s AppImage and should be reported to its authors.

Hello and thanks for the answer. Recently I had downloaded an application (the name is not important), with was compressed into an AppImage. After an attempting to start it, I recieved the error as in the title.

I had wrote it here because it’s an common error to AppImages, in hope that there will be found a solution to this issue/

With regards,

Mcgiwer

Possibly your distribution is lacking some of the dependencies of the Qt platform plugin “xcb”. Please try again using Ubuntu.

Hello. I double checked that the xcbproto and the binding for Qt are installed, but this hasn’t helped at all. Maybe would be a good idea that the xcb dependencies would be included into tha AppImage (like it got made with Python3.8)

So your AppImage is also not running e.g., on Ubuntu bionic?
Is it listed on https://appimage.github.io/?
If not, please submit it there for getting tested.

Hello. I was testing it on Ubuntu 20.04 and Debian 10 and had solved the XCB issue by typing into the command line following code:

sudo xhost si:localuser:$USER

if [ -z ${DISPLAY} ]; then export DISPLAY=:0; fi

(instead the variable can be used the user name)

1 Like

Now that is really strange.
Why doesn’t the system do this by default?

  • Are you using Wayland by any chance?
  • Are you running the AppImage as root by any chance?

Possibly related: xorg - xhost: unable to open display "0" - Ask Ubuntu

The given fix allow the user (represented as the variable ${USER}) to access the X11 and after it, it’s ensured that the DISPLAY variable is set.

The issue is generated because of two reasons:

  1. system (from unknown reasons) removes the permission for the user to access some parts of the X11 (remove the xhost entry with permit the user access)

  2. system (from unknown reasons) unset the DISPLAY variable

Are you running Wayland or Xorg?

I use X11, however I’m not sure if Debian 10 does not have wayland too…