In fact, this was a bug in Awkward Array that was fixed in PR #776, which will probably be merged into the main
branch by the time you read this.
I recognize that it can be difficult to distinguish user errors from internal bugs from the error messages—the general rule in Awkward Array is that RuntimeError
is an internal bug, ValueError
is a user error—but any error when Numba is trying to determine a type is presented as TypeError
, regardless of what it is. (In this case, it was an AttributeError
! It was trying to access numba.bool
when the correct spelling is numba.boolean
.)
However, if you think that something might be a bug, it would be easier if you report it as a GitHub Issue. It is also helpful to print out the whole error message, like this:
E numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
E No implementation of function Function(<built-in function getitem>) found for signature:
E
E >>> getitem(ak.ArrayView(ak.VirtualArrayType({"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":1,"format":"?","primitive":"bool","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}, none, {}), None, ()), Literal[int](2))
E
E There are 28 candidate implementations:
E - Of which 26 did not match due to:
E Overload of function 'getitem': File: <numerous>: Line N/A.
E With argument(s): '(ak.ArrayView(ak.VirtualArrayType({"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":1,"format":"?","primitive":"bool","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}, none, {}), None, ()), int64)':
E No match.
E - Of which 2 did not match due to:
E Overload in function 'type_getitem.generic': File: ../../../../irishep/awkward-1.0/awkward/_connect/_numba/arrayview.py: Line 575.
E With argument(s): '(ak.ArrayView(ak.VirtualArrayType({"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":1,"format":"?","primitive":"bool","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}, none, {}), None, ()), int64)':
E Rejected as the implementation raised a specific error:
E AttributeError: module 'numba' has no attribute 'bool'
E raised from /home/jpivarski/irishep/awkward-1.0/awkward/_connect/_numba/layout.py:565
E
E During: typing of intrinsic-call at /home/jpivarski/irishep/awkward-1.0/tests/test_0776-numba-booleans-in-array.py (16)
E During: typing of static-get-item at /home/jpivarski/irishep/awkward-1.0/tests/test_0776-numba-booleans-in-array.py (16)
E
E File "tests/test_0776-numba-booleans-in-array.py", line 16:
E def f1(array):
E return array[2][0].x
E ^
../../miniconda3/lib/python3.8/site-packages/numba/core/dispatcher.py:357: TypingError
The part of the error message that you quoted, luckily enough, included the part "module 'numba' has no attribute 'bool'
", which gave me a place to start. But it was crucial to understanding this bug that Photon
is a virtual array—the offending numba.bool
happens in virtual array-handling. (Coffea NanoEvents are virtual—they read data from ROOT files on demand, even inside a Numba JIT-compiled function.) The full error message includes the fact that this array has VirtualArrayType
.
The best bug reports include some data to reproduce the issue (i.e. how did you get the Photon
object?), but the GitHub Issue template prompts you for this.
Thanks for reporting this, though! Any report helps!