Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pygraphviz, ImportError: undefined symbol: Agundirected

import pygraphviz

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/__init__.py", line 58, in <module>
    from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/agraph.py", line 26, in <module>
    from . import graphviz as gv
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/graphviz.py", line 28, in <module>
    _graphviz = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/pygraphviz/graphviz.py", line 24, in swig_import_helper
    _mod = imp.load_module('_graphviz', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/pygraphviz/_graphviz.so: undefined symbol: Agundirected

I have already tried

pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"

I have also tried this answer but still not working

Python does not see pygraphviz

like image 920
midhun j Avatar asked Oct 01 '15 10:10

midhun j


1 Answers

First of all, uninstall your current module:

 pip uninstall pygraphviz

then check your paths with:

 pkg-config --libs-only-L libcgraph
 pkg-config --cflags-only-I libcgraph

That commands should tell the path to the library, for example:

-I/usr/include/graphviz  

Then, using the path from the above output, run [within your virtualenv] the command:

pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"

Source: https://github.com/pygraphviz/pygraphviz/issues/71

like image 134
Martin0x777 Avatar answered Sep 30 '22 08:09

Martin0x777