[pygtk] How to install pyGTK on Mac?

156 views
Skip to first unread message

Stayvoid

unread,
Dec 31, 2011, 4:48:26 AM12/31/11
to py...@daa.com.au
Hi there!

How to install it?

This FAQ looks outdated:
http://faq.pygtk.org/index.py?req=show&file=faq01.019.htp

I've also tried to compile it from source:
PyGTK asked for pkg-config and pygobject.
Pygobject asked for pkg-config.
Pkg-config asked for pkg-config and glib:
configure: error: pkg-config and glib-2.0 not found, please set
GLIB_CFLAGS and GLIB_LIBS to the correct values

I know that there is no glib on Mac by default. Where can I get it?


Cheers!
_______________________________________________
pygtk mailing list py...@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Anders F Björklund

unread,
Dec 31, 2011, 5:15:29 AM12/31/11
to Stayvoid, pygtk-list Mailinglist
Stayvoid wrote:

> Hi there!
>
> How to install it?
>
> This FAQ looks outdated:
> http://faq.pygtk.org/index.py?req=show&file=faq01.019.htp

The entry and links are outdated, but the ways are right...

If you want to use GTK-OSX and jhbuild, see the new page:
http://live.gnome.org/GTK%2B/OSX/Building (or gtk.org)

If you want to use MacPorts or Fink, the links are now:
http://www.macports.org/ and http://www.finkproject.org/

> I've also tried to compile it from source:
> PyGTK asked for pkg-config and pygobject.
> Pygobject asked for pkg-config.
> Pkg-config asked for pkg-config and glib:
> configure: error: pkg-config and glib-2.0 not found, please set
> GLIB_CFLAGS and GLIB_LIBS to the correct values
>
> I know that there is no glib on Mac by default. Where can I get it?

If you want to compile everything up from source, see:
http://developer.gnome.org/gtk/stable/gtk-building.html

I have made some binary packages, for Mac OS X 10.5 up:
http://macpkg.sourceforge.net/

The PyGTK.pkg contains everything needed to run PyGTK.

--anders

syk...@astalavista.com

unread,
Dec 31, 2011, 5:24:37 AM12/31/11
to py...@daa.com.au
Ladies and gentleman, I will be unplugged from my email until the 17th of January.

In the mean time here's a video of a bunny opening your mail http://www.youtube.com/watch?v=LMyaRmTwdKs

Your mail will not be forwarded and I will contact you when I come back, alternatively you can contact one of the other administrators or email in...@astalavista.com

Merry christmas and a happy new year!

Best regards,
Sykadul

Stayvoid

unread,
Dec 31, 2011, 5:33:34 PM12/31/11
to pygtk-list Mailinglist
I've used MacPorts.

I've installed pyGTK:
sudo port -v install py26-gtk

I've copied the module to have a chance to run it by typing "python":
cp /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pygtk.py
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pygtk.py

Thanks for your help.

Arjan Molenaar

unread,
Jan 1, 2012, 6:17:01 AM1/1/12
to Stayvoid, pygtk-list Mailinglist
Hi,

I've been using Homebrew (https://github.com/mxcl/homebrew) for a while and I'm very happy with it. Big advantage is that it's not compiling everything from source (it's using the system Python installation).

There are several forks with PyGtk included. I'm currently using https://github.com/ashgti/homebrew.

However, since I upgraded to OS X Lion, I'm facing some issues with signal handling. Default stuff al works, only my own library (Gaphas) is having some trouble.

Regards,

Arjan

Anders F Björklund

unread,
Jan 1, 2012, 6:53:27 AM1/1/12
to Stayvoid, pygtk-list Mailinglist
Stayvoid wrote:

> I've used MacPorts.
>
> I've installed pyGTK:
> sudo port -v install py26-gtk
>
> I've copied the module to have a chance to run it by typing "python":
> cp /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pygtk.py
> /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pygtk.py
>
> Thanks for your help.

That is not supported, mixing installations like that...

If you use MacPorts PyGTK, you need to use /opt/local/bin/python2.6
rather than /usr/bin/python. And you'd normally use "site-packages" ?

/Library/Python/2.6/site-packages/

The same goes for Fink, and pygtk2-gtk-py26 (with /sw/bin/python2.6).
If you use GTK-OSX, you'll bundle both Python and GTK with your app.

--anders

Anders F Björklund

unread,
Jan 1, 2012, 7:10:56 AM1/1/12
to Arjan Molenaar, pygtk-list Mailinglist
Arjan Molenaar wrote:

> I've been using Homebrew (https://github.com/mxcl/homebrew) for a while and I'm very happy with it. Big advantage is that it's not compiling everything from source (it's using the system Python installation).
>
> There are several forks with PyGtk included. I'm currently using https://github.com/ashgti/homebrew.

I don't use Homebrew, for this.

1) It's _not_ supported upstream (no Python modules allowed)
2) It would use the X11 server, rather than the native Quartz
3) You would still need Xcode and compile GTK+ etc from source

I did have my own fork of Homebrew, and it worked just fine...
It would be possible to use Python, Quartz and "bottles" even
with Homebrew, but in the end* it just wasn't worth the effort ?

* https://github.com/mxcl/homebrew/pull/3946

So that's why I did my own build system and binary packages. :-P

--anders

Arjan Molenaar

unread,
Jan 1, 2012, 8:00:59 AM1/1/12
to Anders F Björklund, pygtk-list Mailinglist

On 1 Jan 2012, at 13:10, Anders F Björklund wrote:

> Arjan Molenaar wrote:
>
>> I've been using Homebrew (https://github.com/mxcl/homebrew) for a while and I'm very happy with it. Big advantage is that it's not compiling everything from source (it's using the system Python installation).
>>
>> There are several forks with PyGtk included. I'm currently using https://github.com/ashgti/homebrew.
>
> I don't use Homebrew, for this.
>
> 1) It's _not_ supported upstream (no Python modules allowed)
> 2) It would use the X11 server, rather than the native Quartz
> 3) You would still need Xcode and compile GTK+ etc from source
>
> I did have my own fork of Homebrew, and it worked just fine...
> It would be possible to use Python, Quartz and "bottles" even
> with Homebrew, but in the end* it just wasn't worth the effort ?
>
> * https://github.com/mxcl/homebrew/pull/3946
>
> So that's why I did my own build system and binary packages. :-P
>
> --anders

I saw a mail come by on this subject a while ago indeed. Back then I did not have time to look into it. I'll give it a try. Thanks for reminding :).

There are a few things behaving slightly different in the Quartz version, but I think I can iron those out.

Personally I have no trouble using X11, but towards users using native Quartz is somewhat more usable.

Regards,

Arjan

Stayvoid

unread,
Jan 1, 2012, 8:18:49 AM1/1/12
to Anders F Björklund, pygtk-list Mailinglist
> That is not supported, mixing installations like that...
> If you use MacPorts PyGTK, you need to use /opt/local/bin/python2.6
> rather than /usr/bin/python.

Are you sure? I've successfully imported the module:
$ python
>>> import pygtk
>>> dir(pygtk)
['__all__', '__builtins__', '__doc__', '__file__', '__name__',
'__package__', '_get_available_versions', '_our_dir',
'_pygtk_2_0_dir', '_pygtk_dir_pat', '_pygtk_required_version',
'fnmatch', 'glob', 'os', 'require', 'require20', 'sys']

> And you'd normally use "site-packages"?

I use the default one.

http://docs.python.org/using/mac.html:
"The Apple-provided build of Python is installed in
/System/Library/Frameworks/Python.framework and /usr/bin/python,
respectively."

Is there a way to use PyGTK while running "python" (/usr/bin/python)?

Anders F Björklund

unread,
Jan 1, 2012, 11:54:32 AM1/1/12
to Arjan Molenaar, pygtk-list Mailinglist
Arjan Molenaar wrote:

> There are a few things behaving slightly different in the Quartz version, but I think I can iron those out.
>
> Personally I have no trouble using X11, but towards users using native Quartz is somewhat more usable.

It's not like there's any major difference in appearance -
the main visible change is whether the window has an [X]...

There's a gtk-quartz-engine, but it's kinda buggy so I just
used Clearlooks as the default (but Murrine is included too).


I see that your brew fork have a "native-gtk+" formula too,
so I guess it has both covered. But Homebrew is all about X11.

https://github.com/mxcl/homebrew/issues/1442
https://github.com/mxcl/homebrew/issues/1612

--anders

Anders F Björklund

unread,
Jan 1, 2012, 11:57:16 AM1/1/12
to Stayvoid, pygtk-list Mailinglist
Stayvoid wrote:

>> That is not supported, mixing installations like that...
>> If you use MacPorts PyGTK, you need to use /opt/local/bin/python2.6
>> rather than /usr/bin/python.
>
> Are you sure? I've successfully imported the module:

[...]

It's not so much about "can't" as it is about "shouldn't".

> Is there a way to use PyGTK while running "python" (/usr/bin/python)?

Yes, use a PyGTK installation intended for system python ?

--anders

Stayvoid

unread,
Jan 1, 2012, 12:40:14 PM1/1/12
to Anders F Björklund, pygtk-list Mailinglist
> Yes, use a PyGTK installation intended for system python?
How?

Should I install any other modules if I want to use it for drawing?

Arjan Molenaar

unread,
Jan 1, 2012, 4:24:05 PM1/1/12
to Anders F Björklund, pygtk-list Mailinglist

On 1 Jan 2012, at 17:54, Anders F Björklund wrote:

> Arjan Molenaar wrote:
>
>> There are a few things behaving slightly different in the Quartz version, but I think I can iron those out.
>>
>> Personally I have no trouble using X11, but towards users using native Quartz is somewhat more usable.
>
> It's not like there's any major difference in appearance -
> the main visible change is whether the window has an [X]...
>
> There's a gtk-quartz-engine, but it's kinda buggy so I just
> used Clearlooks as the default (but Murrine is included too).
>
>
> I see that your brew fork have a "native-gtk+" formula too,
> so I guess it has both covered. But Homebrew is all about X11.
>
> https://github.com/mxcl/homebrew/issues/1442
> https://github.com/mxcl/homebrew/issues/1612
>
> --anders
>

Hi,

When playing around I noticed DnD is not fully operational. I'm missing the context.targets. Since my app is quite dependent on DnD this is a big miss.

Do you know if a newer release of Gtk+ 2.x fixes this? If so, do you plan on making a build for that?

Any plans on preparing an installation for GTK+ 3?

Is your build/release process documented somewhere?

Regards,

Arjan

Anders F Björklund

unread,
Jan 2, 2012, 4:30:10 PM1/2/12
to Arjan Molenaar, pygtk-list Mailinglist
Arjan Molenaar:

> When playing around I noticed DnD is not fully operational. I'm missing the context.targets. Since my app is quite dependent on DnD this is a big miss.
>
> Do you know if a newer release of Gtk+ 2.x fixes this? If so, do you plan on making a build for that?

I don't know, but if you have a reproducer then check
the mailing list and the bug list if you haven't already ?

Our Zero Install apps don't really use much of DnD, or
any other advanced features of PyGTK for that matter. :-)

> Any plans on preparing an installation for GTK+ 3?
>
> Is your build/release process documented somewhere?

Not really, and it's in transit over to the new project...
http://macpkg.git.sourceforge.net/git/gitweb-index.cgi
It's based on the Win32 packages (from http://www.gtk.org/):
http://afb.users.sourceforge.net/zero-install/buildscripts/

I'll probably have it download and checksum the tarballs too,
but currently it assumes that you have already done so before
and placed everything in the same directory that is used for
the build (the scripts just use the current working directory).

Not sure if there'll be any Python 3000 or GTK+ 3.2 packages,
but probably a 2.24.1 PyGTK.pkg - to match the Win32 offering ?

All the actual development takes place in the GTK-OSX project
on gnome.org, but it doesn't offer any pre-compiled binaries.

--anders

Arjan Molenaar

unread,
Jan 3, 2012, 3:26:00 PM1/3/12
to Anders F Björklund, pygtk-list Mailinglist

On 2 Jan 2012, at 22:30, Anders F Björklund wrote:

> Arjan Molenaar:
>
>> When playing around I noticed DnD is not fully operational. I'm missing the context.targets. Since my app is quite dependent on DnD this is a big miss.
>>
>> Do you know if a newer release of Gtk+ 2.x fixes this? If so, do you plan on making a build for that?
>
> I don't know, but if you have a reproducer then check
> the mailing list and the bug list if you haven't already ?
>
> Our Zero Install apps don't really use much of DnD, or
> any other advanced features of PyGTK for that matter. :-)
>
>> Any plans on preparing an installation for GTK+ 3?
>>
>> Is your build/release process documented somewhere?
>
> Not really, and it's in transit over to the new project...
> http://macpkg.git.sourceforge.net/git/gitweb-index.cgi
> It's based on the Win32 packages (from http://www.gtk.org/):
> http://afb.users.sourceforge.net/zero-install/buildscripts/
>
> I'll probably have it download and checksum the tarballs too,
> but currently it assumes that you have already done so before
> and placed everything in the same directory that is used for
> the build (the scripts just use the current working directory).
>
> Not sure if there'll be any Python 3000 or GTK+ 3.2 packages,
> but probably a 2.24.1 PyGTK.pkg - to match the Win32 offering ?
>
> All the actual development takes place in the GTK-OSX project
> on gnome.org, but it doesn't offer any pre-compiled binaries.

I managed to compile the whole lot with jhbuild. I'll spend some time with the Quartz port. There are a few things that can be improved, so I might as well lend a hand (as far as time permits). ;)

Regards,

Arjan

Anders F Björklund

unread,
Jan 3, 2012, 4:26:37 PM1/3/12
to Arjan Molenaar, pygtk-list Mailinglist
Arjan Molenaar wrote:

>>> Any plans on preparing an installation for GTK+ 3?
>>>
>>> Is your build/release process documented somewhere?

>> Not sure if there'll be any Python 3000 or GTK+ 3.2 packages,


>> but probably a 2.24.1 PyGTK.pkg - to match the Win32 offering ?
>>
>> All the actual development takes place in the GTK-OSX project
>> on gnome.org, but it doesn't offer any pre-compiled binaries.
>
> I managed to compile the whole lot with jhbuild. I'll spend some time with the Quartz port. There are a few things that can be improved, so I might as well lend a hand (as far as time permits). ;)

That's probably the best, as that's the upstream build system.

It does require that you bundle Python and GTK+ with your app,
but that only matters for distribution and not for development.

For the record, the URL is: http://live.gnome.org/GTK%2B/OSX

But when I packaged our app for the fourth* time, I wondered
why there were no binaries - so went ahead and did a fifth pkg.

--anders

* port, fink, jhbuild, brew

7stud

unread,
Feb 12, 2012, 4:06:39 PM2/12/12
to py...@daa.com.au
> I have made some binary packages, for Mac OS X 10.5 up:
> http://macpkg.sourceforge.net/

> The PyGTK.pkg contains everything needed to run PyGTK.

What is the md5 for the package. Or where can I find it. I'm getting:

MD5 (/Users/me/Downloads/PyGTK.pkg) = 06196e48d022e458b60d43784a91d86b

--
View this message in context: http://python.6.n6.nabble.com/How-to-install-pyGTK-on-Mac-tp2661952p4463134.html
Sent from the Gtk+ - Python mailing list archive at Nabble.com.

Anders F Björklund

unread,
Feb 12, 2012, 5:33:04 PM2/12/12
to 7stud, py...@daa.com.au
7stud wrote:

>> I have made some binary packages, for Mac OS X 10.5 up:
>> http://macpkg.sourceforge.net/
>
>> The PyGTK.pkg contains everything needed to run PyGTK.
>
> What is the md5 for the package. Or where can I find it. I'm getting:
>
> MD5 (/Users/me/Downloads/PyGTK.pkg) = 06196e48d022e458b60d43784a91d86b

Find it on http://sourceforge.net/projects/macpkg/files/PyGTK/2.24.0/

Is there a problem with the package ? Maybe I should have signed it.

--anders

PS. The (i) button on the download page above has the MD5 and SHA1.

7stud

unread,
Feb 12, 2012, 5:54:01 PM2/12/12
to py...@daa.com.au

Anders F Björklund-3 wrote

>
> Is there a problem with the package ? Maybe I should have signed it.
>

I don't know yet, I haven't installed it. I wanted to make sure I was
downloading what was advertised.

Thanks.

--
View this message in context: http://python.6.n6.nabble.com/How-to-install-pyGTK-on-Mac-tp2661952p4463341.html


Sent from the Gtk+ - Python mailing list archive at Nabble.com.

7stud

unread,
Feb 12, 2012, 7:57:09 PM2/12/12
to py...@daa.com.au

7stud wrote

>
>
> I don't know yet, I haven't installed it. I wanted to make sure I was
> downloading what was advertised.
>
> Thanks.
>

My install seems to be working on some hello world gui's. I'm reading the
tutorial here:

http://www.learngtk.org/pygtk-tutorial

Thanks for your help--and for creating the mac os x package. I've used
tkinter and wxpython, so I'm curious to see how pygtk stacks up.

--
View this message in context: http://python.6.n6.nabble.com/How-to-install-pyGTK-on-Mac-tp2661952p4463580.html

Reply all
Reply to author
Forward
0 new messages