Search code examples
pythonbokehholoviewsdatashader

Error when building graph with bundle_graph/datashader


I'm going through this tutorial to learn a bit about datashader and bokeh.

Most of it seems to be fine, except a few examples. For example, this code:

    %%opts Nodes (size=5)
    graph = layout_nodes(hv.Graph(edges_df), layout=forceatlas2_layout)
    forceatlas = bundle_graph(graph, split=False)
    pad = dict(x=(-.5, 1.3), y=(-.5, 1.3))
    datashade(forceatlas, width=800, height=800, cmap=fire[128:]) * forceatlas.nodes.redim.range(**pad)  

produces the following error:

      1 graph = layout_nodes(hv.Graph(edges_df), layout=forceatlas2_layout)
----> 2 forceatlas = bundle_graph(graph, split=False)
      3 pad = dict(x=(-.5, 1.3), y=(-.5, 1.3))
      4 datashade(forceatlas, width=800, height=800, cmap=fire[128:]) * forceatlas.nodes.redim.range(**pad)
...
    493         for i in range(10):
    494             for batch in edge_segments:
--> 495                 smooth(batch, p.tension, segment_class.idx, segment_class.idy)
    496 
    497         # Flatten things

TypeError: can't unbox heterogeneous list

Solution

  • It sounds like you're hitting this bug, which is fixed on datashader master and will be included in the next release (Datashader 0.7). In the meantime, you can downgrade Numba to 0.38.1, which should avoid the problem.