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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.

You Might Also Like