#40179: Can't import gi.repository after installing gtk3 ------------------------+-------------------------------- Reporter: istlota@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: invalid | Keywords: Port: gtk3 | ------------------------+-------------------------------- Comment (by cal@…): Replying to [comment:3 istlota@…]:
Thanks. It continues to amaze me how promptly MacPorts support responds to opened tickets, especially considering that I opened this ticket on a Sunday.
I just happened to be at doing MacPorts-related stuff anyway. Replying to [comment:3 istlota@…]:
Ergo, why did installing the gtk3 port on my mac end up with python not being able to find gi.repository?
The software installed by the `gtk3` port does not need the python bindings from `py27-gobject3`. This is also the reason why there is no dependency from `gtk3` to `py27-gobject3` (also: if there was, which version of python should we depend on? There is `py{26,27,31,32,33}-gobject3`). Replying to [comment:3 istlota@…]:
Which means gtk3 incorrectly installed py27-gobject when it needed to install py27-gobject3 to operate properly. To be more specific, gtk3 installed at-spi2-atk as a dependency, which installed dbus-python27 as a dependency, which installed p27-gobject as a dependency.
First: `gtk3` does not need `py27-gobject3` to operate properly. Dependent software that uses the python bindings for Gtk might, but that software should declare a dependency on `py27-gobject3` then. I don't know (despite being the maintainer for this port) why `at- spi2-atk` needs `dbus-python27`. `dbus-python27` needs a dependency on `py27-gobject` (the gtk2 version), because it uses an old API provided by `py27-gobject` (but I just noticed the relevant file `./dbus/gobject_service.py` in the `dbus-python27` sources also supports using `py27-gobject3`). You could file a bug requesting to change the dependency to `py27-gobject3` instead of `py27-gobject`. But even this won't solve your original issue, because `gtk3 -x11 +quartz` doesn't pull in `at-spi2-atk` and thus doesn't have a transitive dependency on `py27-gobject3`. Replying to [comment:3 istlota@…]:
Is this one of those catch-22s the entire industry is having to just accept for now due to having two Ways of binding Python to GTK [GTK2 and PyGtk vs. GTK3 and PyGObject] which can and often do break each other when both are used on the same machine?
How do PyGtk and PyGObject break each other? I haven't noticed any problems with running both versions simultaneously. Replying to [comment:3 istlota@…]:
Or, can the gtk3 portfile, perhaps, be modified to install the appropriate flavor of gobject3 [py27-gobject3 in my case] as a dependency?
As explained above, this is not the correct way to fix this. Dependent software needs to depend on `py*-gobject3` if it needs the Gtk Python bindings. If you need them for a project outside MacPorts I'm afraid you will have to install them manually. -- Ticket URL: <https://trac.macports.org/ticket/40179#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X