Meld error "Cannot import: GTK+; No module named repository"


Meld used to work on my machine (openSuse Linux 13.1, Python 2.7.6) but after having trouble with Spyder (like it refusing to actually run any scripts), I uninstalled a large number of things, then slowly brought them back again.

Since then, meld does not work anymore. I keep getting this error message

> meld
Cannot import: GTK+
No module named gi

I was able to solve that by installing gi:

> pip install gi

Now the error is replaced by:

> meld
Cannot import: GTK+
No module named repository

… and here is a similar question where uninstalling gi apparently helped? I’m confused. I did try uninstalling it again but that just brought me back to the previous error (duh!).

Any ideas?

Asked By: Zak



OK, that was not obvious:

gi.repository is not part of gi but its own thing. That’s why gi should not be installed (thank you Moose).

This article then pointed me to a possible source, python-gobject. However, I already had that installed. So I installed other things that looked similar, and the python-gobject-cairo package ( Python 2.7, openSuse 13.1) did the trick. Seems like someone overlooked a dependency for Meld…

Answered By: Zak

I unlinked the file that was showing in Expected in:

Expected in: /Applications/

unlink /Applications/
Answered By: ishandutta2007

After changing python3 from version 3.7 to 3.6 error disappeared.

I have done that by:

sudo apt-get install python3.6
sudo rm /usr/bin/python3
sudo ln -s /usr/bin/python3.6 /usr/bin/python3
Answered By: Jake Finn

If your python3 refers to python3.7 or higher version, and there is python3 below 3.7 in your system(or install one), such as python3.6(/usr/bin/python3.6), this may works:

sudo vi `which meld`

and change the python3 to python3.6 in line1, and save, reopen the meld.

Answered By: Victor Li
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.