Search code examples
pythonpygtkmacports

How to correctly install pyGTK using macports?


My python code uses GTK for some GUI and now i need to run some of it on OSX (10.6 Snow Leopard and 10.7 Lion). Unfortunately, unofficial pyGTK build crashes on window GTK windows resize, so i decided to test macports version. I installed python and pygtk via following macports commands:

sudo port install python26
sudo port select --set python python26
sudo port install py-gtk2

Running python from console correctly starts macports version of python. But trying to execute import gtk or import pygtk fails with error that such package is not available :(.

I have a feeling that I missed something very simple to get all to work. Something like setting correct site-package for macports python or whatever. Maybe some guru may share a bit of wisdom?

UPDATE: Careful examination revealed that py-gtk2 was installed only into /opt/local/lib/python2.4/site-packages, leaving .../python2.6/site-packages and .../python2.7/site-packages blank. Running macports version of python 2.4 allows me to use pyGTK. But I want it with python 2.6 (preferred) or 2.7 :(.


Solution

  • Port name was incorrect. Correct ports are py25-gtk / py26-gtk / py27-gtk.

    Updated: recently renamed to py25-pygtk / py26-pygtk / py27-pygtk