Reputation: 119
i have try all the possible command given below:
pip install pgi , pip install PyGObject , pip install python-gi
Still not able to install the module in python . Installed python 3.7 also try to make a virtual environment but not able to install the module .
#import cv2
import gi
import numpy as np
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Upvotes: 10
Views: 68120
Reputation: 21
On a RHEL8 variant (Rocky Linux 8) the resolution was to use /usr/bin/python3.6m instead of regular python3.6 (or any of the other Python variants I had installed which did not end with an 'm').
More info on 'm' variants can be found here: What's the difference between python3.<x> and python3.<x>m
Upvotes: 1
Reputation: 11
Bit late on the answer but I am having the same problem in 2023. I have the same problem with a python installation as user in /usr/local/bin instead of /usr/bin. Hope this helps someone
Upvotes: 0
Reputation: 845
I got my python setup properly trashed on Ubuntu 20.04. I was trying to use apt-add-repository and got "ModuleNotFoundError: No module named 'gi'". I had already installed software-properties-common and python3-gi using apt. For me the answer was
sudo apt-get --reinstall install python3-gi
Upvotes: 1
Reputation: 2554
In an Arch based distro, this worked for me. You can use another AUR helper such as Pamac or Yay instead of Paru.
paru -S gobject-introspection
pip install pygobject
Upvotes: 4
Reputation: 13
Try this:
sudo apt install libcairo2-dev libxt-dev libgirepository1.0-dev
pip install pycairo PyGObject
Upvotes: 33