# Error when creating plot from dask xarray using latest package versions

**URL:** <https://discourse.holoviz.org/t/error-when-creating-plot-from-dask-xarray-using-latest-package-versions/8926>\
**Category:** Datashader\
**Created:** [September 7, 2025, 6:52pm UTC](https://discourse.holoviz.org/t/error-when-creating-plot-from-dask-xarray-using-latest-package-versions/8926 "2025-09-07T18:52:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nanoputian628](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/nanoputian628/32/7320_2.png) [@Nanoputian628](https://discourse.holoviz.org/u/Nanoputian628)\
**Post date:** [September 7, 2025, 6:52pm UTC](https://discourse.holoviz.org/t/error-when-creating-plot-from-dask-xarray-using-latest-package-versions/8926/1 "2025-09-07T18:52:36Z")

</div>

I have created a new environment, installing the latest versions of numpy, dask, datashader. However, I get an error when I try to plot a dask xarray. When I use a xarray then I don’t get any errors. Moreover, if I install instead datashader 0.16.1 then everything works without issues.

**Minimal reproducible example**

```auto
# create dask array
N = 1000
dask_array = da.random.random((N, N), chunks=(N/10, N/10)) # .compute()
# convert to dasked xarray
dask_xarray = xr.DataArray(
    dask_array,
    dims=["x", "y"],
    coords={"x": np.arange(N), "y": np.arange(N)},
    name="example_data", # Name of the data variable
)
# create plot using Datashader
tf.shade(ds.Canvas(plot_height=300, plot_width=300).raster(dask_xarray))

```

**Error message**

```auto
TypingError Traceback (most recent call last)
Cell In[4], line 12
      5 dask_xarray = xr.DataArray(
      6 dask_array,
      7 dims=["x", "y"],
      8 coords={"x": np.arange(N), "y": np.arange(N)},
      9 name="example_data", # Name of the data variable
     10 )
     11 # create plot using Datashader
---> 12 tf.shade(ds.Canvas(plot_height=300, plot_width=300).raster(dask_xarray))

File D:\ProgramData\environments\ds_test\lib\site-packages\datashader\core.py:1155, in Canvas.raster(self, source, layer, upsample_method, downsample_method, nan_value, agg, interpolate, chunksize, max_mem)
   1151 data = resample_2d_distributed(
   1152 source_window, chunksize=chunksize, max_mem=max_mem,
   1153 **kwargs)
   1154 else:
-> 1155 data = resample_2d(source_window, **kwargs)
   1156 layers = 1
   1157 else:

File D:\ProgramData\environments\ds_test\lib\site-packages\datashader\resampling.py:347, in resample_2d(src, w, h, ds_method, us_method, fill_value, mode_rank, x_offset, y_offset, out)
    344 if isinstance(src, np.ma.MaskedArray):
    345 src = src.data
--> 347 resampled = _resample_2d(src, mask, use_mask, ds_method, us_method,
    348 fill_value, mode_rank, x_offset, y_offset, out)
    349 return _mask_or_not(resampled, src, fill_value)

File D:\ProgramData\environments\ds_test\lib\site-packages\datashader\resampling.py:499, in _resample_2d(src, mask, use_mask, ds_method, us_method, fill_value, mode_rank, x_offset, y_offset, out)
    497 def _resample_2d(src, mask, use_mask, ds_method, us_method, fill_value,
    498 mode_rank, x_offset, y_offset, out):
--> 499 src_w, src_h, out_w, out_h = _get_dimensions(src, out)
    500 x0_off, x1_off = x_offset
    501 y0_off, y1_off = y_offset

File D:\ProgramData\environments\ds_test\lib\site-packages\numba\core\dispatcher.py:424, in _DispatcherBase._compile_for_args(self, *args, **kws)
    420 msg = (f"{str(e).rstrip()} \n\nThis error may have been caused "
    421 f"by the following argument(s):\n{args_str}\n")
    422 e.patch_message(msg)
--> 424 error_rewrite(e, 'typing')
    425 except errors.UnsupportedError as e:
    426 # Something unsupported is present in the user code, add help info
    427 error_rewrite(e, 'unsupported_error')

File D:\ProgramData\environments\ds_test\lib\site-packages\numba\core\dispatcher.py:365, in _DispatcherBase._compile_for_args.<locals>.error_rewrite(e, issue_type)
    363 raise e
    364 else:
--> 365 raise e.with_traceback(None)

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
non-precise type pyobject
During: typing of argument at D:\ProgramData\environments\ds_test\lib\site-packages\datashader\resampling.py (488)

File "D:\ProgramData\environments\ds_test\lib\site-packages\datashader\resampling.py", line 488:
def _get_fill_value(fill_value, src, out):
    <source elided>

@ngjit
^

During: Pass nopython_type_inference 

This error may have been caused by the following argument(s):
- argument 0: Cannot determine Numba type of <class 'dask.array.core.Array'> 

This error may have been caused by the following argument(s):
- argument 0: Cannot determine Numba type of <class 'dask.array.core.Array'>

```

**Package Versions**  
numpy: 2.2.6  
dask: 2025.7.0  
datashader: 0.18.2  
numba: 0.61.2

First reported [here](https://github.com/holoviz/datashader/pull/1448).

---

<div class="post-metadata">

**Author:** ![Nanoputian628](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/nanoputian628/32/7320_2.png) [@Nanoputian628](https://discourse.holoviz.org/u/Nanoputian628)\
**Post date:** [September 8, 2025, 10:46am UTC](https://discourse.holoviz.org/t/error-when-creating-plot-from-dask-xarray-using-latest-package-versions/8926/2 "2025-09-08T10:46:23Z")

</div>

It turns out this issue is because `pyarrow` needs to be installed. This will be addressed by the below pull request.

> <https://github.com/holoviz/datashader/pull/1452>
>
> Fixes https://github.com/holoviz/datashader/pull/1448#issuecomment-3264898482
> 
> …
> I'm not sure if this would be too annoying, but I couldn't think of a better way to do it. 
> 
> \`\`\` python
> ❯ python -c "import dask.dataframe"
> Traceback (most recent call last):
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/dask/\_compatibility.py", line 114, in import\_optional\_dependency
> module = importlib.import\_module(name)
> File "/home/shh/.local/conda/envs/holoviz/lib/python3.13/importlib/\_\_init\_\_.py", line 88, in import\_module
> return \_bootstrap.\_gcd\_import(name\[level:\], package, level)
> ~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "\<frozen importlib.\_bootstrap\>", line 1387, in \_gcd\_import
> File "\<frozen importlib.\_bootstrap\>", line 1360, in \_find\_and\_load
> File "\<frozen importlib.\_bootstrap\>", line 1324, in \_find\_and\_load\_unlocked
> ModuleNotFoundError: No module named 'pyarrow'
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "\<string\>", line 1, in \<module\>
> import dask.dataframe
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/dask/dataframe/\_\_init\_\_.py", line 24, in \<module\>
> from dask.dataframe import backends, dispatch
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/dask/dataframe/backends.py", line 14, in \<module\>
> from dask.dataframe.\_compat import PANDAS\_GE\_220, is\_any\_real\_numeric\_dtype
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/dask/dataframe/\_compat.py", line 11, in \<module\>
> import\_optional\_dependency("pyarrow")
> ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/dask/\_compatibility.py", line 117, in import\_optional\_dependency
> raise ImportError(msg) from err
> ImportError: Missing optional dependency 'pyarrow'. Use pip or conda to install pyarrow.
> \`\`\`
> 
> 
> 
> \`\`\` python
> ❯ python example\_dask\_crash.py
> /home/shh/projects/holoviz/repos/datashader/example\_dask\_crash.py:3: RuntimeWarning: dask requires pyarrow to work with datashader.
> import datashader as ds
> Traceback (most recent call last):
> File "/home/shh/projects/holoviz/repos/datashader/example\_dask\_crash.py", line 20, in \<module\>
> arr = ds.Canvas(plot\_height=300, plot\_width=300).raster(dask\_xarray)
> File "/home/shh/projects/holoviz/repos/datashader/datashader/core.py", line 1155, in raster
> data = resample\_2d(source\_window, \*\*kwargs)
> File "/home/shh/projects/holoviz/repos/datashader/datashader/resampling.py", line 347, in resample\_2d
> resampled = \_resample\_2d(src, mask, use\_mask, ds\_method, us\_method,
> fill\_value, mode\_rank, x\_offset, y\_offset, out)
> File "/home/shh/projects/holoviz/repos/datashader/datashader/resampling.py", line 499, in \_resample\_2d
> src\_w, src\_h, out\_w, out\_h = \_get\_dimensions(src, out)
> ~~~~~~~~~~~~~~~ ^^^^^^^^^^
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/numba/core/dispatcher.py", line 424, in \_compile\_for\_args
> error\_rewrite(e, 'typing')
> ~~~~~~~~~~~~~ ^^^^^^^^^^^^^
> File "/home/shh/projects/holoviz/repos/datashader/.venv/lib/python3.13/site-packages/numba/core/dispatcher.py", line 365, in error\_rewrite
> raise e.with\_traceback(None)
> numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
> non-precise type pyobject
> During: typing of argument at /home/shh/projects/holoviz/repos/datashader/datashader/resampling.py (488)
> 
> File "datashader/resampling.py", line 488:
> def \_get\_fill\_value(fill\_value, src, out):
> \<source elided\>
> 
> @ngjit
> ^
> 
> During: Pass nopython\_type\_inference
> 
> This error may have been caused by the following argument(s):
> \- argument 0: Cannot determine Numba type of \<class 'dask.array.core.Array'\>
> 
> \`\`\`
