Skip to content


Request: PyGObject 3 #12901

SimonSapin opened this Issue · 22 comments

6 participants



I’m not sure this is the right channel for such requests. Please redirect me if it is not. I would like to see PyGObject 3.x packaged for OS X.

WeasyPrint is a Python project that uses Pango’s introspection through PyGObject. Users can generally manage to install the Python parts themselves, but PyGObject is more tricky: the current version in Homebrew is 2.28, but we need 3.x. These are somewhat incompatible: linux distributions generally make separate packages for both.



Is 3.x for python3?
Or is it a completely different software? Would one want to have both installed at the same time?


PyGObject 3.x exists for both python3 and python2, just like PyGObject 2.x. So there can be up to 4 different combinations of these (more if you care about various pythonX.Y versions)

It is an evolution of the same software but yes, they should be possible to install at the same time as they are not compatible.

There are also attempts to do this in Macports:

For this to be useful, "introspection" needs to be enabled in relevant libraries like Pango.


Sounds like something we'd like to have. I'll have a try next week and we'll see how difficult that is. Disclaimer: I only used wxPython so far.


Since I opened this ticket PyGObject 3 has been added to MacPorts:

See also the discussion in the related WeasyPrint ticket:

I don’t think that wxPython is related in any way to PyGObject.


Thanks. I'll do that.

We cannot tolerate MacPorts to have it and we not :-P


To be fair, MacPorts includes too much stuff and that's why a lot of it is broken. Would it be impossible for something like PyGObject to be in pip? That's where I'd expect to find it.


@samueljohn: In that case I will only point out that WeasyPrint itself has been submitted to Macports ;)

@mikemcquaid: pip install PyGObject gives something like this on my system:

* Building PyGObject using distutils is only supported on windows. *
* To build PyGObject in a supported way, read the INSTALL file.    *

Command python egg_info failed with error code 1

I’ll leave it to those making Homebrew to decide if WeasyPrint should be included. Once CPython, Pango, PyGObject and pycairo are all there with the right introspection flags, installing WeasyPrint and the rest of its dependencies with pip generally works well.


There is a big discussion in the python community going on right now about the "broken" packaging and how to fix it. Pure python modules work well. When there are c dependencies and/or parts of the software in C then it begins to be difficult.

Next week I'll have time to look into PyGObject. I also had the idea to put some python modules/bindings wich have problems with pip into an fork of homebrew (which would be available via the excellent brew tap mechanism.).
I am not an official collaborator of homebrew, so I can only open a pull request and let them decide.

WeasyPrint? Never heard of :-)


Yes, there is a lot that could be improved with Python packaging in general. In the meantime, I won’t tell the PyGObject upstream (GNOME) how they should do their packaging :) I wouldn’t say that PyGObject is broken, only it builds with tools other than usual in Python.

WeasyPrint is a new (one year old) Python project that makes PDF from HTML+CSS. You can read more on the website or chat on our mailing list if you’re interested. The dependencies make it non-obvious to install. We (WeasyPrint developers) have heard of a few people who tried and failed on OS X because of PyGObject 3 (hence this request) although none of us use OS X or Homebrew.


@SimonSapin WeasyPrint sounds nice. I'll try to make a PyGobject formula since I think this could be the basis for many projects. Wether that will be in the homebrew core or for the time being in my fork of homebrew-alt. (I have not done this yet). But it's a quite easy way to go. When I have done the initial version, perhaps you can have a look, @SimonSapin?


@samueljohn do you mean a formula for PyGObject or for WeasyPrint? In any case, I can have a look but I don’t have an OS X system myself to test it. I’ll be sure to tell our two OS X users though :)


@SimonSapin ok no problem. I think a formula for PyGObject would be good. Is WeasyPrint pure Python? Then I think pip is the way to go. Homebrew can only try to support Python formulas by providing the C dependencies.


WeasyPrint itself is currently pure Python. If we add some C or Cython in the future we’ll make sure it builds with distutils/pip.

Note that for PyGObject to be useful to WeasyPrint, we also need introspection enabled in Pango. I just opened another issue for this.


Will review a pull request that provides this software.

@adamv adamv closed this

It is unclear why this issue was closed when you read the original request above.

To me it still seems impossible to use brew to install pygobject 3.x.


It was closed because no one submitted a formula for review.


In the meantime, WeasyPrint gave up on PyGObject and now uses CFFI instead, which installs with pip. So I’m not personally interested by this anymore.


@SimonSapin even if you're not interested anymore the issue still persists, PyGObject still fails with pip and does not install with the brew formula either.


@spaghetti- feel free to nag PyGObject developers about it :)


@SimonSapin well I'll be on that however I got it to compile by updating the brew formula myself. So as of now I've glib, gobject-introspection and pygobject properly installed. But I still can't import gi from python.

Any idea whats wrong?


@spaghetti- I don’t know, and I’m no interested anymore. Sorry. Maybe somebody else can help.



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.