0

I use dnf install opencv.

sudo dnf install opencv opencv-contrib opencv-core opencv-devel opencv-doc python3-opencv

Then I run the python code:

import cv2 as cv
img = cv.imread('/home/a/dog.jpeg')
cv.imshow('dog', img)

Then I got the following error:

QSocketNotifier: Can only be used with threads started with QThread

My system is Fedora release 34.

Why and how to solve it?

Ceopee
  • 316
  • 4
  • 12
Bralow Qin
  • 61
  • 4

1 Answers1

3

The problem is about Wayland. Most probably your display server is Gnome with Wayland as the default. Solution 1:

switched the session to Gnome with Xorg which uses X11 as the display server, the Qt GUI looks normal.

Solution 2: I guess it is a common bug in fedora. I've found many similar issues with a quick search for different fedora versions ( 30, 31, 32 SO thread, 33). That's why, you can try to build opencv and set WITH_QT flag OFF from the source rather than dnf package manager.

Not sure about the backbone of the problem but the bug tracker may help if RedHat cares.

Ceopee
  • 316
  • 4
  • 12