RuntimeError: Gtk couldn't be initialized

Hi there

Just installed graph-tool for the first time & get this error. What does it mean? How can i fix? I'm on Ubuntu Server 12.04

Much appreciated

from graph_tool.all import *

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/graph_tool/", line 31, in <module>
    from graph_tool.draw import *
  File "/usr/lib/python2.7/dist-packages/graph_tool/draw/", line 589, in <module>
    from cairo_draw import graph_draw, GraphWidget, GraphWindow, \
  File "/usr/lib/python2.7/dist-packages/graph_tool/draw/", line 59, in <module>
    from gi.repository import Gtk, Gdk, GdkPixbuf
  File "/usr/lib/python2.7/dist-packages/gi/", line 76, in load_module
  File "/usr/lib/python2.7/dist-packages/gi/", line 224, in _load
    overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
  File "/usr/lib/python2.7/dist-packages/gi/overrides/", line 1517, in <module>
    raise RuntimeError("Gtk couldn't be initialized")
RuntimeError: Gtk couldn't be initialized

attachment.html (1.52 KB)

This is a bug in the python bindings for Gtk, which fail to load if
there is no DISPLAY environment variable. I have already included a
workaround in graph-tool, and I'm preparing the new packages for ubuntu,
which will be uploaded soon.