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

**URL:** <https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405>\
**Category:** Creating AppImages\
**Created:** [June 16, 2021, 8:57am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405 "2021-06-16T08:57:28Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![quizilkend](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/quizilkend/32/569_2.png) [@quizilkend](https://discourse.appimage.org/u/quizilkend)\
**Post date:** [June 16, 2021, 8:57am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/1 "2021-06-16T08:57:28Z")

</div>

Hey there,

I am trying to get [FlatCAM](http://flatcam.org/) 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](https://appimage-builder.readthedocs.io/en/latest/examples/pyqt.html) 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:

```auto
./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`:

```auto
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

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [June 19, 2021, 8:40am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/2 "2021-06-19T08:40:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![quizilkend](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/quizilkend/32/569_2.png) [@quizilkend](https://discourse.appimage.org/u/quizilkend)\
**Post date:** [June 20, 2021, 10:13am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/3 "2021-06-20T10:13:06Z")

</div>

Okay.

I did:

> **[Provide Appimage](https://bitbucket.org/jpcgt/flatcam/issues/515/provide-appimage)**
>
> Hey there,
> 
> would it be possible to provide an Appimage of FlatCAM? This would be really awesome and more people could use it out of the box.
> 
> Best regards  
> Samuel

---

<div class="post-metadata">

**Author:** ![mcgiwer](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mcgiwer/32/589_2.png) [@mcgiwer](https://discourse.appimage.org/u/mcgiwer)\
**Post date:** [July 9, 2021, 8:49pm UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/4 "2021-07-09T20:49:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [July 9, 2021, 11:52pm UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/5 "2021-07-09T23:52:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mcgiwer](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mcgiwer/32/589_2.png) [@mcgiwer](https://discourse.appimage.org/u/mcgiwer)\
**Post date:** [July 10, 2021, 10:32am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/6 "2021-07-10T10:32:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [July 13, 2021, 9:16pm UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/7 "2021-07-13T21:16:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mcgiwer](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mcgiwer/32/589_2.png) [@mcgiwer](https://discourse.appimage.org/u/mcgiwer)\
**Post date:** [July 14, 2021, 11:18am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/8 "2021-07-14T11:18:02Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [July 18, 2021, 8:03am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/9 "2021-07-18T08:03:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mcgiwer](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mcgiwer/32/589_2.png) [@mcgiwer](https://discourse.appimage.org/u/mcgiwer)\
**Post date:** [July 18, 2021, 9:10pm UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/10 "2021-07-18T21:10:41Z")

</div>

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:

```auto
sudo xhost si:localuser:$USER

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

```

(instead the variable can be used the user name)

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [August 3, 2021, 6:04am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/11 "2021-08-03T06:04:42Z")

</div>

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](https://askubuntu.com/questions/1108934/xhost-unable-to-open-display-0)

---

<div class="post-metadata">

**Author:** ![mcgiwer](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mcgiwer/32/589_2.png) [@mcgiwer](https://discourse.appimage.org/u/mcgiwer)\
**Post date:** [August 5, 2021, 10:20am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/12 "2021-08-05T10:20:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [August 16, 2021, 8:21am UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/13 "2021-08-16T08:21:21Z")

</div>

Are you running Wayland or Xorg?

---

<div class="post-metadata">

**Author:** ![mcgiwer](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mcgiwer/32/589_2.png) [@mcgiwer](https://discourse.appimage.org/u/mcgiwer)\
**Post date:** [August 16, 2021, 2:32pm UTC](https://discourse.appimage.org/t/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/2405/14 "2021-08-16T14:32:52Z")

</div>

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