You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
default_device and default_dtype fail with NumPy < 2.1 #1078
Based on CI failures I've been getting in scipy/scipy#26550, I believe these will fail:
importarray_api_extraasxpximportnumpyasnpxpx.default_dtype(np) # AttributeError: module 'numpy' has no attribute '__array_namespace_info__'xpx.default_device(np) # presumably would fail, too
I'm having trouble testing in Colab because I get an older array-api-extra with NumPy 2.0. Anyway, it makes sense, since NumPy only added __array_namespace_info__ in SciPy 2.1.
On a related note, it would be nice to have a function that returned that array-api-compat version of a namespace given the namespace. One can do, e.g., array_namespace(xp.asarray(0)) # skip device check but creating temporary arrays is exactly what default_dtype and default_device saves us from. Perhaps array_api_compat.array_namespace should also just accept backends?
Activity
lucascolley commentedon Oct 31, 2026
To confirm, does
xpx.default_dtype(array_api_compat.numpy)work as expected? If so, my initial reaction would be to close as not planned, given https://data-apis.org/array-api-extra/library-design.html#scope.mdhaber commentedon Nov 1, 2026
Yes. OK, but then it's unfortunate that ScIPy's internal
xp_default_dtypewas removed in favor ofxpx.default_dtype.