dask: dask array failing with numpy 1.17.0rc1 and np.min

Using Python 3.7, dask 2.0, (from conda-forge) and NumPy 1.17.0rc1 (from pip):

import numpy as np
import dask.array as da

image = da.from_array(np.array([[0, 1], [1, 2]]), chunks=(1, 2))
image_min = int(np.min(image))

results in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<__array_function__ internals>", line 6, in amin
TypeError: no implementation found for 'numpy.amin' on types that implement __array_function__: [<class 'dask.array.core.Array'>]

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Closing as Dask 2.1.0 is out which includes the fix from #5043. Thanks all!

Don’t think I like the decorator so much, that messes with stacklevel

That’s not true:

def matches_numpy_api(np_func):
    def decorator(my_func):
        _numpy_to_my_funcs[np_func] = my_func
        return my_func  # no wrapper created, so no arg mangling or stack addition
    return decorator

isn’t less typing than an explicit mapping

It’s not less typing, but it distributes the mapping alongside each function, rather than centralizing it. That means that it’s easier to spot a missing map entry.

The name is lousy, but it’s up to dask to pick that 😃

It may not be too late to change TypeError with a warning + old behavior.