Gtk-Error: GTK+ 2.x symbols detected... ideas for work around?

I'm wondering if anyone has an idea for a work around with my problem.

I've written a gui using pyqt which I guess uses gtk 3.x. When I import
graph_tool.draw, I get an error message saying

(main.py:3823): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and
GTK+ 3 in the same process is not supported
Trace/breakpoint trap (core dumped)

I've been thinking that the easiest solution would be to call anything
graph_tool related in a separate process. Thoughts on this?

How would I import graph_tool without importing draw? More specifically,
which submodule provides the core functionality?

I'm wondering if anyone has an idea for a work around with my problem.

I've written a gui using pyqt which I guess uses gtk 3.x. When I import
graph_tool.draw, I get an error message saying

PyQt uses the QT libraries, not GTK+. It would be quite disturbing if it
imported any GTK+ symbols.

(main.py:3823): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and
GTK+ 3 in the same process is not supported
Trace/breakpoint trap (core dumped)

This is probably due to something else pulling GTK+ 2 symbols, while
graph-tool uses GTK+ 3. A common source of this is matplotlib. Verify
your matplotlibrc file, and set it to use GTK+ 3 or QT.

I've been thinking that the easiest solution would be to call anything
graph_tool related in a separate process. Thoughts on this?

Seems overly complicated.

How would I import graph_tool without importing draw? More specifically,
which submodule provides the core functionality?

Just import anything but graph_tool.draw... The core functionality is
provided by just making 'import graph_tool'.

Cheers,
Tiago

I changed my ~/user/.matplotlib/matplotlibrc to use Qt4Agg. No luck. Same
with anything else I try. Cairo, wx...all the same.

The error is happening immediately after I run main.py. The code makes no
immediate calls to graph_tools except for importing graph_tools.draw

Well, _something_ is importing pygtk or otherwise loading GTK+ 2. The
graph_tool.draw module loads GTK+ 3, and these can't coexist. You must
find out which module is including GTK+ 2. Since I do not know what
other modules you are loading, there is little else I can say...

Not solved, but..

I created a VM with Debian Squeeze, installed pyqt4 and graph-tool from the
repo provided. Code works just fine.
I created a second VM with Ubuntu 12.04 (what I'm using now). Installed
pyqt4 and graph-tool. The error pops up.

When I run main.py in gdb, I can see that gtk is actually being called when
I import qt4. I don't know what specifically in pyqt4 is triggering this.

Either way, thanks for your help. I can stick with Debian for now and swap
out qt later down the road.

Here is a possibility: You can configure Qt to use a native GTK theme,
via QGtkStyle. This will actually use GTK+ to draw the widgets, and load
the library. If you are using this, than this may be your problem. Try
changing the QT theme to see if it has any effect.

Cheers,
Tiago