Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed Eclipse + PyDev + Python 3.2. Now I have two Python interpreters in PyDev: Python 2.7 and Python 3.2. If I try to execute command import pygtk with 2.7 interpreter it works fine, but with Python 3.2 it raises ImportError: No module named pygtk.

How can I get PyGTK to work with Python 3.2?

share|improve this question
up vote 20 down vote accepted

PyGTK has been deprecated in favor of PyGI+GTK. Because of that, a version of PyGTK for Python 3 was never written.

To use PyGI+GTK in Python 3, you need to install the python3-gobject package and do

from gi.repository import Gtk

For a quick introduction on porting PyGTK code to PyGI+GTK, see here:

For a full tutorial, see here:

share|improve this answer
"a version of PyGTK for Python 3 was never written." - that's not what the pygtk website says - do you mean was never packaged for ubuntu? – Random832 Nov 23 '12 at 21:37
No, I mean it was never written. What exactly did you see in the pygtk website? – Marcelo Hashimoto Dec 15 '12 at 1:24
I misread someting about PyGObject - it's confusing that there are announcements about that on the PyGTK website: > PyGobject 2.26.0 has been released. This is the first stable release in the 2.26.x series and introduces initial support for introspection and Python 3. As usual, sources can be fetched from here. Check out the release announcement and full list of changes. – Random832 Dec 17 '12 at 0:42

One small addition: python3-gobject was renamed python3-gi in Precise. You can still install via the old name, but if you don't need to support anything older than Precise, use python3-gi in your debian/control.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.