0

I'm using a Raspberry pi 5, I'm having issues running ultralytics and PyQt5 at the same time. The way I installed ultralytics and PyQt5 are different. First I used

sudo apt install python3-pyqt5

, then created a virtual environment with --system-site-packages. So I can still access PyQt5 because for some reason using

pip install PyQt5

does not work in system wide and virtual environment. For ultralytics is used

pip install ultralytics[export]

When I run them separately they work but when I use them at the same time it does not work. I created an app the using PyQt5 for facial detect with the help of ultralytics and YOLO but this error shows when I run my code this error appears:

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

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/admin/myvenv/lib/python3.11/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.

Process ended with exit code -6.

Does anyone know how to deal with this?

2
  • Since your error mentions OpenCV (cv2), it might help to reinstall OpenCV in your virtual environment. Sometimes, the OpenCV installation may cause conflicts with PyQt5. Commented Nov 2, 2024 at 15:30
  • I tried installing opnecv still does not work Commented Nov 4, 2024 at 16:32

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.