Why am I getting the ImportError ../lib/libgobject-2.0.so.0: undefined symbol: g_uri_ref based on order of import?

Viewed 1725

On one of my experiments, I found this strange behavior. If I do

import matplotlib.pyplot as plt

import cv2

Then I get ImportError

ImportError: /home/deep/anaconda3/bin/../lib/libgobject-2.0.so.0: undefined symbol: g_uri_ref enter image description here

But, If I change the order of imports as

import cv2

import matplotlib.pyplot as plt

Everything runs fine. Matplotlib version is 3.2.2 and cv2 version is 4.3.0 I tried to see if I could find some similar problem or explanation, but have not yet found an answer. I'm not sure why this problem occurs and how to fix it.

2 Answers

set up a virtual enviroment (best with anaconda) to be save and try:

pip3 install opencv-python==4.5.1.48

and

pip3 install pyqt5

So far it works, but I get other errors. owever, this could be due to my own script. I will update if I have more info.

Good luck

You can try install the mentioned package, libgobject-2.0.so.0 from here: https://pkgs.org/search/?q=libgobject-2.0.so.0
For Ubuntu:
Step 1: Update the package index:

sudo apt-get update

Step 2: Install libglib2.0-0 deb package:

sudo apt-get install libglib2.0-0
Related