5

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
HARSH BHATNAGAR
  • 69
  • 1
  • 1
  • 7
  • did u tried python3-gi? – shamnad sherief Mar 06 '22 at 11:14
  • There are MANY (as in thousands!) questions about ModuleNotFoundError already. Could you please try to make this question unique and clear? You wrote that you already tried a virtual environment. That's good. Could you [edit] your question and describe the **_exact_** commands you used to create and activate that environment, the **_exact_** command you used to run the Python script, and the exact output of that command? With that information, it will be pretty simple for others to reproduce the issue and answer the question. – wovano Mar 06 '22 at 15:22
  • Note that [this answer](https://stackoverflow.com/a/56451612/10669875) already provides some explanation and solutions for installing and using Python packages in WIndows. This solution might apply to your question as well, but maybe not. It's hard to tell without more information. NB: Please also add which module you are trying to use (link to pypi?) – wovano Mar 06 '22 at 15:26
  • I think this seems to fully answer the question: [Python cannot install PyGObject](https://stackoverflow.com/questions/33862049/python-cannot-install-pygobject) If so, this question should be closed as duplicate. – wovano Mar 06 '22 at 15:32
  • NB: official installation instructions for PyGObject are [here](https://pygobject.readthedocs.io/en/latest/getting_started.html) – wovano Mar 06 '22 at 15:33

2 Answers2

15

Try this:

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

pip install pycairo PyGObject
Bakuutin
  • 301
  • 1
  • 9
sxyxxn
  • 13
  • 7
0

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
misantroop
  • 2,276
  • 1
  • 16
  • 24