PyGraphviz on OS X (SL) with virtualenv

Published on 2010-07-14 22:14:00+00:00
Mac   OS   Python   X   graphviz   virtualenv  

There's this cool project called django-extensions that (among other things) adds a lot of commands to django's manage.py offerings. One of which is ./manage.py graph_models [appname] which will generate a nice graph displaying the relationships among all of your Models. This comand needs pyGraphViz, though, and I was a little disappointed when i discovered I couldn't install pyGraphViz with pip install pygraphviz. (ok, a lot disappointed).

I eventually got this working, and here's how:

  
library_path=None  
include_path=None

And change them to

  
library_path='/usr/local/lib/graphviz/'  
include_path='/usr/local/include/graphviz/'

You also might want to verify that the above directories exist.

That's it! This installed pygraphviz in my activated virtualenv, and I can now use ./manage.py graph_models to my heart's desire.

I should mention that I'm using distribute (and it may be safe to assume that if you're using virtualenv, you're probably also using distribute).