Python does not see pygraphviz

Sashko Lykhenko picture Sashko Lykhenko · Mar 27, 2013 · Viewed 56.3k times · Source

I have installed pygraphviz using easy_install But when i launch python i have an error:

>>>import pygraphviz as pgv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygraphviz
>>> 

Using Ubuntu 12.04 and gnome-terminal.

Answer

Sidharth Shah picture Sidharth Shah · Mar 27, 2013

Assuming that you're on Ubuntu please look at following steps

  1. sudo apt-get install graphviz libgraphviz-dev pkg-config
  2. Create and activate virtualenv if needed. The commands looks something like sudo apt-get install python-pip python-virtualenv
  3. Run pip install pygraphviz
  4. Run terminal and check by importing and see if it works