4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

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.`)の解決策

Last updated at Posted at 2022-07-06

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.

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?