Version 2.45 graph_draw fails on macOS with "did not match C++ signature"
Bug reports:
I'm the MacPorts maintainer, trying to update to version 2.45. graph-tool
builds fine, but gt.graph_draw
throws the error:
graph_tool.draw.libgraph_tool_draw.cairo_draw(GraphInterface, any, any, any, bool, dict, dict, dict, dict, int, int, cairo.Context) did not match C++ signature: cairo_draw(graph_tool::GraphInterface {lvalue}, boost::any, boost::any, boost::any, bool, boost::python::dict, boost::python::dict, boost::python::dict, boost::python::dict, double, long long, boost::python::api::object)
This error does not occur with version 2.43.
Full error below.
Versions:
macOS 12.4 21F79 x86_64
Xcode 13.4.1 13F100
port installed cairomm cgal5 mm-common
The following ports are currently installed:
cairomm @1.12.2_0+quartz+x11 (active)
cgal5 @5.5_0 (active)
mm-common @1.0.4_0 (active)
I attempted to upgrade cairomm to 1.15.5 and 1.16.1 but encountered build issues with these apparently unstable mm releases.
Related: https://github.com/macports/macports-ports/pull/15493
Please follow the general troubleshooting steps first:
-
Are you running the latest graph-tool
version? -
Do you observe the problem with the current git version? -
Are you using Macports or Homebrew? If yes, please submit an issue there instead: https://github.com/Homebrew/brew/issues and https://trac.macports.org/newticket -
Did you compile graph-tool
manually? -
If you answered yes above, did you use the exact same compiler to build graph-tool
,boost-python
andPython
?
Please replace this section with a brief summary of your issue.
Do not forget to supply the following information:
-
A minimal and self-contained example that shows the problem. -
Your operating system. -
The Python version you are using. -
If you compiled graph-tool manually: Your compiler version, as well as the version of Boost being used. -
If you are reporting a compilation error, please provide the entire ./configure
output, as well as the entire contents of theconfig.log
file and the entire compilation output.
Do not forget to add code snippets and error messages using Markdown, i.e.
Insert your code/shell command/error message here.
import graph_tool.all as gt
g = gt.Graph()
v0 = g.add_vertex()
v1 = g.add_vertex()
v2 = g.add_vertex()
e01 = g.add_edge(v0, v1)
e12 = g.add_edge(v1, v2)
e20 = g.add_edge(v2, v0)
gt.graph_draw(g)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/gtk_draw.py:786, in GraphWidget.fit_to_window(self, ink, g)
785 try:
--> 786 x, y, w, h = self.fit_view
787 zoom = min(geometry[0] / w, geometry[1] / h)
TypeError: cannot unpack non-iterable bool object
During handling of the above exception, another exception occurred:
ArgumentError Traceback (most recent call last)
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/gtk_draw.py:574, in GraphWidget.draw(self, da, cr)
572 if self.geometry is None:
573 adjust_default_sizes(self.g, geometry, self.vprops, self.eprops)
--> 574 self.fit_to_window(ink=False)
575 self.regenerate_surface()
576 self.geometry = geometry
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/gtk_draw.py:807, in GraphWidget.fit_to_window(self, ink, g)
804 pos = group_vector_property([pos_x, pos_y])
806 if self.fit_view_ink:
--> 807 x, y, zoom = fit_to_view_ink(g, pos, geometry, self.vprops,
808 self.eprops, pad=pad)
809 else:
810 x, y, zoom = fit_to_view(get_bb(g, pos), geometry,
811 pad=pad)
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/cairo_draw.py:1353, in fit_to_view_ink(g, pos, output_size, vprops, eprops, adjust_aspect, pad)
1350 vprops = dict(vprops, pen_width=min_lw(vprops.get("pen_width", 0.)))
1351 eprops = dict(eprops, pen_width=min_lw(eprops.get("pen_width", 0.)))
-> 1353 cairo_draw(g, pos, cr, vprops, eprops)
1355 bb = list(srf.ink_extents())
1357 bb[0], bb[1] = cr.device_to_user(bb[0], bb[1])
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/cairo_draw.py:677, in cairo_draw(g, pos, cr, vprops, eprops, vorder, eorder, nodesfirst, vcmap, ecmap, loop_angle, parallel_distance, res, max_render_time, **kwargs)
674 parallel_distance = _defaults
675 eprops["control_points"] = position_parallel_edges(g, pos, loop_angle,
676 parallel_distance)
--> 677 generator = libgraph_tool_draw.cairo_draw(g._Graph__graph,
678 _prop("v", g, pos),
679 _prop("v", g, vorder),
680 _prop("e", g, eorder),
681 nodesfirst, vattrs, eattrs, vdefs, edefs, res,
682 max_render_time, cr)
683 if max_render_time >= 0:
684 def gen():
ArgumentError: Python argument types in
graph_tool.draw.libgraph_tool_draw.cairo_draw(GraphInterface, any, any, any, bool, dict, dict, dict, dict, int, int, cairo.Context)
did not match C++ signature:
cairo_draw(graph_tool::GraphInterface {lvalue}, boost::any, boost::any, boost::any, bool, boost::python::dict, boost::python::dict, boost::python::dict, boost::python::dict, double, long long, boost::python::api::object)
---------------------------------------------------------------------------
ArgumentError Traceback (most recent call last)
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/gtk_draw.py:459, in GraphWidget.layout_callback(self)
457 if self.vertex_matrix is not None:
458 self.vertex_matrix.update()
--> 459 self.regenerate_surface(reset=True, complete=True)
460 self.queue_draw()
461 ps = ungroup_vector_property(self.pos, [0, 1])
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/gtk_draw.py:552, in GraphWidget.regenerate_surface(self, reset, complete)
550 mtime = -1 if complete else self.regenerate_max_time
551 res = 5 * self.get_scale_factor()
--> 552 gen = cairo_draw(self.g, self.pos, cr, self.vprops, self.eprops,
553 self.vorder, self.eorder, self.nodesfirst, res=res,
554 max_render_time=mtime, **self.kwargs)
555 self.regenerate_generator = gen
556 self.regen_context = cr
File /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/graph_tool/draw/cairo_draw.py:677, in cairo_draw(g, pos, cr, vprops, eprops, vorder, eorder, nodesfirst, vcmap, ecmap, loop_angle, parallel_distance, res, max_render_time, **kwargs)
674 parallel_distance = _defaults
675 eprops["control_points"] = position_parallel_edges(g, pos, loop_angle,
676 parallel_distance)
--> 677 generator = libgraph_tool_draw.cairo_draw(g._Graph__graph,
678 _prop("v", g, pos),
679 _prop("v", g, vorder),
680 _prop("e", g, eorder),
681 nodesfirst, vattrs, eattrs, vdefs, edefs, res,
682 max_render_time, cr)
683 if max_render_time >= 0:
684 def gen():
ArgumentError: Python argument types in
graph_tool.draw.libgraph_tool_draw.cairo_draw(GraphInterface, any, any, any, bool, dict, dict, dict, dict, int, int, cairo.Context)
did not match C++ signature:
cairo_draw(graph_tool::GraphInterface {lvalue}, boost::any, boost::any, boost::any, bool, boost::python::dict, boost::python::dict, boost::python::dict, boost::python::dict, double, long long, boost::python::api::object)
Out[10]:
(<VertexPropertyMap object with value type 'vector<double>', for Graph 0x10476ef80, at 0x104a0d4b0>,
<VertexPropertyMap object with value type 'bool', for Graph 0x10476ef80, at 0x145bc6350>)