DISPLAYなし環境でpyqt5を使おうとするとエラー(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.
)
$ python start.py
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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
以下を参考に環境変数を設定(export QT_QPA_PLATFORM=offscreen
)することでDISPLAYなし環境でエラー回避できた
https://stackoverflow.com/questions/37662616/create-a-pyqt-build-in-gitlab/55442821#55442821
But QT_QPA_PLATFORM: "offscreen" work like a charm and saved the day.
$ export QT_QPA_PLATFORM=offscreen
$ python start.py
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ubuntu'
This plugin does not support propagateSizeHints()
This plugin does not support propagateSizeHints()
=================================================>
以降、動作する
参考
But QT_QPA_PLATFORM: "offscreen" work like a charm and saved the day.