Table of Contents
Run PyQt5 in Ubuntu
When running a PyQt5 application on Ubuntu, I hit this Qt platform plugin error:
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.
In my case, the application could find the xcb Qt platform plugin, but one of the libraries needed by that plugin was missing. Installing the missing xcb dependency fixed the problem.

A useful first check is to run the application with Qt plugin debugging enabled:
QT_DEBUG_PLUGINS=1 python3 your_app.py
The output usually shows which shared library failed to load. On many Ubuntu installations, the missing package is one of the libxcb runtime libraries. A common fix is:
sudo apt update
sudo apt install libxcb-xinerama0
If the error remains, install the package that provides the specific missing library reported by QT_DEBUG_PLUGINS=1. You can search for it with:
apt-file search name-of-missing-library.so
If apt-file is not installed yet:
sudo apt install apt-file
sudo apt-file update
After installing the missing library, run the PyQt5 application again. If the xcb plugin can load all of its dependencies, the application should start normally.
