No Module Named Gi

No Module Named Gi

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
5

3 Answers

Try this:

sudo apt install libcairo2-dev libxt-dev libgirepository1.0-dev

pip install pycairo PyGObject
3

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.