GeoscienceAustralia / dea-sandbox

Digital Earth Australia Sandbox config and planning
Apache License 2.0
13 stars 6 forks source link

"RuntimeError: No visualization engine detected" when trying to visualise Dask graphs on latest Sandbox image #243

Closed robbibt closed 1 year ago

robbibt commented 1 year ago

Describe the bug If we attempt to visualise a Dask graph on the latest unstable Sandbox image, we get this error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[2], line 11
      2 dc = datacube.Datacube()
      4 ds = dc.load(product="ga_ls8c_nbart_gm_cyear_3",
      5                measurements=["red", "green", "blue"],
      6                x=(128.95, 130.15),
      7                y=(-14.25, -15.40),
      8                time=("2018-01-01", "2018-12-31"),
      9             dask_chunks={})
---> 11 ds.red.data.visualize()

File /env/lib/python3.8/site-packages/dask/base.py:240, in DaskMethodsMixin.visualize(self, filename, format, optimize_graph, **kwargs)
    196 def visualize(self, filename="mydask", format=None, optimize_graph=False, **kwargs):
    197     """Render the computation of this object's task graph using graphviz.
    198 
    199     Requires ``graphviz`` to be installed.
   (...)
    238     https://docs.dask.org/en/latest/optimize.html
    239     """
--> 240     return visualize(
    241         self,
    242         filename=filename,
    243         format=format,
    244         optimize_graph=optimize_graph,
    245         **kwargs,
    246     )

File /env/lib/python3.8/site-packages/dask/base.py:802, in visualize(filename, traverse, optimize_graph, maxval, engine, *args, **kwargs)
    800     return cytoscape_graph(dsk, filename=filename, **kwargs)
    801 elif engine is None:
--> 802     raise RuntimeError(
    803         "No visualization engine detected, please install graphviz or ipycytoscape"
    804     )
    805 else:
    806     raise ValueError(f"Visualization engine {engine} not recognized")

RuntimeError: No visualization engine detected, please install graphviz or ipycytoscape

To Reproduce On unstable image server on prod Sandbox:

import datacube
dc = datacube.Datacube()

ds = dc.load(product="ga_ls8c_nbart_gm_cyear_3",
               measurements=["red", "green", "blue"],
               x=(128.95, 130.15),
               y=(-14.25, -15.40),
               time=("2018-01-01", "2018-12-31"),
            dask_chunks={})

ds.red.data.visualize()

Expected behavior Users can successfully visualise a Dask graph

Screenshots image

robbibt commented 1 year ago

I think this is fixed now, thanks @emmaai!