2 years ago

#27144

test-img

Phobit

[PyQt5]Raspberry Pi either giving error or not showing GUI

I have a Raspberry Pi 3B+ running the official Raspberry Pi OS with Desktop environment. I wrote a script with gui in Python using PyQT5, unfortunatley it doesn't wanna work. On my PC where I coded it everything worked fine.

NOTE: The script is started inside a screen-session, but it doesn't work inside nor outside the screen session.

At first it also worked fine on the raspberry, only giving me a warning which I ignored:

libEGL warning: DRI2: failed to authenticate

but after a reboot it doesn't work at all anymore.

When I start the script I get the error:

    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, xcb.

I tried reinstalling pyqt5 and xcb multiple times, no effect. After that I used

export QT_QPA_PLATFORM=eglfs

to set the other plugins that were mentioned in the error message and tried with all off them; in summary: xcb, eglfs and minimalegl all printed the error message shown above, minimal, linuxfb, offscreen and vnc didn't give me an error and let the script run, but no GUI was showing. executing "ps -A" showed that the script was still running nonetheless. I also read this FAQ: https://pi3d.github.io/html/FAQ.html which mentioned how to fix the warning I got in the beginning, but following it didn't help me, maybe I should have done this when I got the warning the first time... I have run out of ideas, can anyone help me?

python

python-3.x

qt

pyqt5

raspberry-pi3

0 Answers

Your Answer

Accepted video resources