LoginSignup
3
1

More than 1 year has passed since last update.

ubuntu18.04環境で、pyqt5を使いつつopencv-pythonをインストールすると、その後にqtを使用する際にエラーが発生した。

Posted at

ubuntu18.04環境で、pyqt5を使いつつopencv-pythonをインストールすると、その後にqtを使用する際にエラーが発生した。

QObject::moveToThread: Current thread (0x56125f604920) is not the object's thread (0x561262d82a40).
Cannot move to target thread (0x56125f604920)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ubuntu/.pyenv/versions/taichofu_env/lib/python3.6/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.

Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

以下を参考にさせていただき解決

QtとOpenCVの両方をインストールするとエラーが発生する[Python]
どうやら双方にGUI機能が含まれているから競合しているらしい?なので、
$ pip uninstall -y opencv-python
opencv-python をアンインストールして、
$ pip install opencv-python-headless
GUI機能を含まない、OpenCVのヘッドレス版をインストールすると正常に動作しました。

参考

QtとOpenCVの両方をインストールするとエラーが発生する[Python]
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. というエラーが起きたときの対処

3
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
3
1