question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing in dtype to array fails on NumPy master in pip-installed version

See original GitHub issue

Reporting a bug

Please note that this doesn’t happen on the conda-installed version, only pip-installed

import numba
import numpy as np

dt1 = np.dtype("float64")
dt2 = np.dtype("float64")

dtr = np.result_type(dt1, dt2)

@numba.jit(
    nopython=True,
    nogil=True,
    locals={"data_curr": numba.np.numpy_support.from_dtype(dtr)},
)
def _dot_coo_coo(coords1, data1, coords2, data2):  # pragma: no cover
    return np.empty((0,), dtype=dtr)

coords1 = np.array([], dtype=np.int64).reshape((2, 0))
coords2 = coords1

data1 = np.array([], dtype=dt1)
data2 = data1

_dot_coo_coo(coords1, data1, coords2, data2)

Output

Traceback (most recent call last):
  File "sandbox.py", line 23, in <module>
    _dot_coo_coo(coords1, data1, coords2, data2)
TypeError: expected dtype object, got 'numpy.dtype[float64]'

Original issue by @TomAugspurger in pydata/sparse#383

Package    Version
---------- -------------------
llvmlite   0.33.0
numba      0.50.1
numpy      1.20.0.dev0+1ce5457
pip        20.1.1
scipy      1.5.2
setuptools 49.2.0
sparse     0.10.0
wheel      0.34.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
stuartarchibaldcommented, Aug 4, 2020

Note from Numba core dev meeting, preference is to fix up Numba’s use of the macro so as to not have to move NumPy base versions.

1reaction
eric-wiesercommented, Jul 28, 2020

This is probably because there is an ABI change in numpy 1.20, which means that numba must be recompiled. If you rebuild numpy master from source then numba from source, I expect the problem to go away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensorflow 2 Object Detection API: Numpy Version Errors
This error may indicate that you're trying to pass a Tensor to a NumPy call, ... /tensorflow/blob/master/tensorflow/python/ops/array_ops.py
Read more >
Release Notes — NumPy v1.13 Manual
This release by-passes the failing algorithm by using heuristics to detect the presence of the PPC double double format. A side-effect of using...
Read more >
NumPy 1.20.0 Release Notes
The Python versions supported for this release are 3.7-3.9, support for Python 3.6 has been ... Array creation and casting using np.array(arr, dtype)...
Read more >
NumPy 1.23.0 Release Notes
Changes to the promotion and comparisons of structured dtypes. Improvements to f2py. See below for the details,. New functions#. A masked array specialization ......
Read more >
Structured arrays — NumPy v1.24 Manual
Changed in version 1.23: Before NumPy 1.23, a warning was given and False returned when promotion to a common dtype failed. Further, promotion...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found