Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams for eventIdx,pho in enumerate(Photon): for phoIdx,_ in enumerate(pho): vid = Photon[eventIdx][phoIdx].vidNestedWPBitmap vid_cuts1 = PhotonVID(vid,1) vid_cuts2 = PhotonVID(vid,2) vid_cuts3 = PhotonVID(vid,3) if (vid_cuts2 & 0b1110111 == 0b1110111): # without sieie print(Photon[eventIdx][phoIdx].isScEtaEE) # isEcEtaEE is boolean hoe_arr.append(Photon[eventIdx][phoIdx].hoe) sieie_arr.append(Photon[eventIdx][phoIdx].sieie) Isochg_arr.append(Photon[eventIdx][phoIdx].pfRelIso03_chg) return hoe_arr,sieie_arr,Isochg_arr

Error message ##############################

TypingError: Failed in nopython mode pipeline (step: nopython frontend) Internal error at resolving type of attribute "isScEtaEE" of "$112binary_subscr.7". module 'numba' has no attribute 'bool' During: typing of get attribute at (19) Enable logging at debug level for details. File "", line 19: def make_vid_plot(Photon): print(Photon[eventIdx][phoIdx].isScEtaEE) # isEcEtaEE is boolean

###########################

I'm using numba with Coffea but, Numba with boolean seems now working.
How to solve this error?

numba version: 0.51.2

Thank you

There's not enough information in the part of the error message that has been displayed, but it might be a bug in Awkward Array if numba.bool was supposed to be numba.types.boolean in github.com/scikit-hep/awkward-1.0/blob/… Jim Pivarski Mar 3, 2021 at 2:40

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            >>> 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           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           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           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!

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.