Import cv2 - GLib-GObject:ERROR:../subprojects/glib-2.68.1/gobject/gtype.c:2800:g_type_register_static: assertion failed: (static_quark_type_flags)

Hi, all:

My env:

➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
➜  ~ gcc --version
gcc (GCC) 10.3.1 20210627
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
➜  ~ python --version
Python 3.8.10
➜  ~ cmake --version
cmake version 3.20.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

With the NEWEST OpenCV-4.5.3 Release, after successfully install, I got the follownig error message while import cv2.

➜  ~ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
**
GLib-GObject:ERROR:../subprojects/glib-2.68.1/gobject/gtype.c:2800:g_type_register_static: assertion failed: (static_quark_type_flags)
Bail out! GLib-GObject:ERROR:../subprojects/glib-2.68.1/gobject/gtype.c:2800:g_type_register_static: assertion failed: (static_quark_type_flags)
[2]    128157 abort (core dumped)  python

Did anybody meet the same issue?

Cheers
Pei

Finally, I noticed that there are 2 versions of glib in my system… my bad…

However, It looks I really need to set WITH_GSTREAMER OFF to successfully get rid of this ERROR message:

➜  ~ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
**
GLib-GObject:ERROR:../subprojects/glib-2.68.1/gobject/gtype.c:2800:g_type_register_static: assertion failed: (static_quark_type_flags)
Bail out! GLib-GObject:ERROR:../subprojects/glib-2.68.1/gobject/gtype.c:2800:g_type_register_static: assertion failed: (static_quark_type_flags)
[2]    128157 abort (core dumped)  python