3

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 :(.

Community
  • 1
  • 1
grigoryvp
  • 40,413
  • 64
  • 174
  • 277

2 Answers2

8

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

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

grigoryvp
  • 40,413
  • 64
  • 174
  • 277
  • (Note: sorry for the formatting, I'm trying everything I can here to get a damn line break. I read the help and more section but oh well. I suppose I'll just leave the main comment alone...) Looks like that may have changed. I tried to install py27-gtk (fresh macports install, ran selfupdate, on Mountain Lion) and got this: Error: py27-gtk has been replaced by py27-pygtk; please install that port instead Error: org.macports.configure for port py27-gtk returned: obsolete port So I'll note this in the main answer if that's alright. – Taylor Alexander Jul 28 '13 at 01:37
0

Only py27-pygtk is valid macport now

sudo port install py27-pygtk