Search code examples
pythonpygraphviz

pygraphviz layout IOerror


I try to print a graph using pygraphviz. I run the following code and get the following error. Code:

import pygraphviz as pgv

G=pgv.AGraph("k5_attributes.dot")
G.layout(prog = 'neato')
G.draw('file.png')

Error:

Traceback (most recent call last):
  File "./test.py", line 22, in <module>
    G.layout(prog = 'neato')
  File "/usr/lib64/python2.7/site-packages/pygraphviz/agraph.py", line 1359, in layout
    data = self._run_prog(prog, ' '.join([args, "-T", fmt]))
  File "/usr/lib64/python2.7/site-packages/pygraphviz/agraph.py", line 1336, in _run_prog
    raise IOError(b"".join(errors))
IOError: /usr/bin/neato: Symbol `MemTest' has different size in shared     object, consider re-linking

I installed pydot, matplotlib, pygraphviz, numpy, python-devel, cairocffi.

Thank you if someone has an idea of what the problem comes from


Solution

  • The error message is saying that when the program ran /usr/bin/neato (specifically /usr/bin/neato -Tpng ... neato has a problem. "neato" is part of "graphviz".

    You might be able to verify this by running:

    neato -Tpng k5_attributes.dot -o example.png
    

    and you may get the same message:

    Symbol `MemTest' has different size in shared     object, consider re-linking
    

    Usually you can fix this up by uninstalling "graphviz" and then reinstalling it. That will cause things to relink. But to be safe, I'd also uninstall pygraphviz first, and then reinstall that after installing "graphviz".