Search code examples
pythonarchlinuxgraph-tool

NameError: name 'graph_draw' is not defined


After installing AUR package on arch-linux, it was an error during execution of simple piece of code.

makepkg -sri PKGBUILD (to install package)

because there was a strange error, trying to complie from source, so decide to use AUR.

/usr/lib/python3.5/site-packages/graph_tool/draw/cairo_draw.py:38: RuntimeWarning: Error importing cairo. Graph drawing will not work.
  warnings.warn(msg, RuntimeWarning)
/usr/lib/python3.5/site-packages/graph_tool/draw/cairo_draw.py:38: RuntimeWarning: Error importing cairo. Graph drawing will not work.
  warnings.warn(msg, RuntimeWarning)
/usr/lib/python3.5/site-packages/graph_tool/draw/cairo_draw.py:38: RuntimeWarning: Error importing cairo. Graph drawing will not work.
  warnings.warn(msg, RuntimeWarning)
/usr/lib/python3.5/site-packages/graph_tool/all.py:40: RuntimeWarning: Error importing draw module, proceeding nevertheless: No module named 'cairo'
  warnings.warn(msg, RuntimeWarning)
Traceback (most recent call last):
  File "lab_1.py", line 5, in <module>
    graph_draw(g, vertex_text=g.vertex_index)
NameError: name 'graph_draw' is not defined

shell returned 1

This what happens when I try to make, after manually install all recommended.

Makefile:521: recipe for target 'graph_hits.lo' failed
make[4]: *** [graph_hits.lo] Error 1
make[4]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12/src/graph/centrality'
Makefile:731: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12/src/graph'
Makefile:407: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12/src'
Makefile:557: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/kaldown/projects/risk_analysis/graph-tool-2.12'
Makefile:465: recipe for target 'all' failed
make: *** [all] Error 2

https://graph-tool.skewed.de/download

How to solve this on arch-linux?


Solution

  • From the No module named 'cairo' error in the traceback, I'd say you need to install cairo