napari: Napari not working with dask distributed Client

What happened:

TypeError: can not serialize ‘function’ object

In distributed/client.py line 2635 futures = self._graph_to_futures

What you expected to happen:

successful image viewing

Minimal Complete Verifiable Example:

from dask.distributed import Client
import napari
import dask_image.imread as imread

client = Client()
data = imread('./myFiles/*.tif')
napari.view_image(data)

Anything else we need to know?: Works fine when not initializing client, i.e.

import napari
import dask_image.imread as imread

data = imread('./myFiles/*.tif')
napari.view_image(data)

works as expected

Environment:

  • Napari/Dask version: dask 2021.2.0 pyhd8ed1ab_0 conda-forge dask-core 2021.2.0 pyhd8ed1ab_0 conda-forge dask-image 0.5.0 pyh44b312d_0 conda-forge distributed 2021.2.0 py39h6e9494a_0 conda-forge napari 0.4.5 pyhd8ed1ab_0 conda-forge napari-console 0.0.3 pyhd8ed1ab_0 conda-forge napari-plugin-engine 0.1.9 py39h6e9494a_1 conda-forge napari-svg 0.1.4 py_0 conda-forge

  • Python version: python 3.9.2 h2502468_0_cpython conda-forge

  • Operating System: OS X 11.2.1

  • Install method (conda, pip, source): conda

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (12 by maintainers)

Most upvoted comments

Does this happen with an older version of Dask-Image? I think there were some changes to imread in the recent release

In particular would be good to test 0.4.0 to see if this works there as 0.5.0 started using da.map_blocks ( https://github.com/dask/dask-image/pull/165 )

here’s the full trace

image