Skip to content Skip to sidebar Skip to footer

Importerror: No Module Named Gi.repository

I'm trying to launch python script on Ubuntu 10.04: from gi.repository import Nautilus, GObject It doesn't work: Traceback (most recent call last): File 'script.py', line 1, in &

Solution 1:

Try to fix it by installing PyGObject:

# With Apt on Ubuntu:$ sudo apt install python3-gi

# With Yum on CentOS / RHEL:$ sudo yum install python36-gobject.x86_64 

# Or directly with Pip:$ pip3 install PyGObject  

Solution 2:

sudo apt-get install -y python-gobject

Fixed it for me on Ubuntu 18.04.

Solution 3:

@hob's answer for Anaconda didn't work for me, but conda install -c conda-forge pygobject did.

Solution 4:

10.04? That's pre-GNOME 3, so the preferred Python bindings were based on PyGTK, not PyGObject. You need to either use the (obsolete) PyGTK bindings or upgrade to a newer OS.

Solution 5:

Anaconda usually has python package binaries that will work with your platform (Mac or older Ubuntu). According to @Abhijit you need pygobject. It works a lot like pip:

conda install -c auto pygobject

Post a Comment for "Importerror: No Module Named Gi.repository"