Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using python graphviz ImportError: No module named _gv

I'm trying to use graphviz with python and I get the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/gv.py", line 7, in <module>
    import _gv
ImportError: No module named _gv

The system state:

dpkg -l|grep graphviz
ii  graphviz              2.20.2-3ubuntu5      rich set of graph drawing tools
ii  libgraphviz4          2.20.2-3ubuntu5      rich set of graph drawing tools
ii  libgv-python          2.20.2-3ubuntu5      Python bindings for graphviz
ii  python-pygraphviz     0.99-2ubuntu1        Python interface to the Graphviz graph layou

I have Ubuntu 9.10 installed and python2.6

I searched at the internet and found out that probably it's symlink problem, but the workaround they suggested didn't work for me.

like image 751
Ivri Avatar asked Jan 25 '10 16:01

Ivri


2 Answers

I fixed the problem. The solution was:

sudo su   
cd /usr/lib/pyshared/python2.6 
mv _gv.so _gv.so- 
ln -s libgv_python.so _gv.so 
sys.path.append('/usr/lib/pyshared/python2.6')
like image 158
Ivri Avatar answered Nov 06 '22 08:11

Ivri


For Ubuntu 10.04,

cd /usr/lib/pymodules/python2.6

sudo ln -s libgv_python.so _gv.so
like image 40
chucheng Avatar answered Nov 06 '22 06:11

chucheng