Skip to content

qt.qpa.plugin: Could not load QT platform 'xcb' in .... even though it was found Error #24

@gabriel-ing

Description

@gabriel-ing

This is an error which has cropped up a few times on various Linux set-ups, I believed I had fixed this as of version 1.0.6 but a user has recently reported it to me. I believe it comes from a conflict between openCV and pyQT6, and I fixed it on my machine by changing from pyQT5 to pyQT6, but the issue remains.

I have found a fix for the issue:

Firstly, type into the command-line:

QT_DEBUG_PLUGIN=1

This gives debugging information.

The error then changes to:

" qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/anaconda3/envs/SimpliPyTEM/lib/python3.8/site-packages/cv2/qt/plugins" 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. "

A fix I have found elsewhere online is running:

export QT_QPA_PLATFORM=offscreen

However if trying to use the GUI, it will no longer appear.

Instead, this issue seems to be related to the file libqxcb.so which is found in the path detailed in the above error. Strangely, removing this file has been found to fix this error. Simply try:

rm /home/anaconda3/envs/SimpliPyTEM/lib/python3.8/site-packages/cv2/qt/plugins/libqxcb.so

Note that this path may change slightly depending on your install.

This fix has worked for me. If you find this error and are struggling, have a go, if it does not work please report it here and we can try another fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions