0

I am getting the following error when hitting a function in nopython mode.

  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 487, in _compile_for_args
    raise e
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 420, in _compile_for_args
    return_val = self.compile(tuple(argtypes))
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 965, in compile
    cres = self._compiler.compile(args, return_type)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 125, in compile
    status, retval = self._compile_cached(args, return_type)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 139, in _compile_cached
    retval = self._compile_core(args, return_type)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/dispatcher.py", line 152, in _compile_core
    cres = compiler.compile_extra(self.targetdescr.typing_context,
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler.py", line 742, in compile_extra
    return pipeline.compile_extra(func)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler.py", line 460, in compile_extra
    return self._compile_bytecode()
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler.py", line 528, in _compile_bytecode
    return self._compile_core()
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler.py", line 507, in _compile_core
    raise e
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler.py", line 494, in _compile_core
    pm.run(self.state)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 368, in run
    raise patched_exception
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 356, in run
    self._runPass(idx, pass_inst, state)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 311, in _runPass
    mutated |= check(pss.run_pass, internal_state)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 273, in check
    mangled = func(compiler_state)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/typed_passes.py", line 468, in run_pass
    lower.create_cpython_wrapper(flags.release_gil)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/lowering.py", line 297, in create_cpython_wrapper
    self.context.create_cpython_wrapper(self.library, self.fndesc,
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/cpu.py", line 187, in create_cpython_wrapper
    builder.build()
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/callwrapper.py", line 122, in build
    self.build_wrapper(api, builder, closure, args, kws)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/callwrapper.py", line 175, in build_wrapper
    status, retval = self.context.call_conv.call_function(
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/callconv.py", line 909, in call_function
    out = self.context.get_returned_value(builder, resty, retval)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/base.py", line 656, in get_returned_value
    return self.data_model_manager[ty].from_return(builder, val)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/datamodel/models.py", line 627, in from_return
    return self._from("from_data", builder, vals)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/datamodel/models.py", line 561, in _from
    v = getattr(dm, methname)(builder, val)
  File "/home/ws10/.local/lib/python3.10/site-packages/numba/core/datamodel/models.py", line 967, in from_data
    raise NotImplementedError("use load_from_data_pointer() instead")
NotImplementedError: Failed in nopython mode pipeline (step: native lowering)
use load_from_data_pointer() instead

Frankly, I just want to understand the meaning of this error. It says it's a NotImplementedError but what exactly is not implemented? Is it possible it is being thrown because the function is too large? What are they guidelines when one encounters such error? I cannot find anything online or in the documentation? On Numba's Github there are some issues open, but not any workarounds are mentioned.

Any help would be really really appreciated. Thank you.

peakcipher
  • 51
  • 1
  • 7
  • 1
    It seems to be a low-level error when building the CPython wrapper responsible for doing the input/output data conversion from Python to Numba and the opposite one. It is hard to tell more about this without the actual code (at least the signature). For such core issues, I think the Numba's GitHub is generally a better place. – Jérôme Richard May 15 '23 at 22:26
  • 1
    Sometimes a function isn't implemented at all, sometimes there are easy workarounds. It would be easier if you show a reproduceable example. This is for example a stack array implementation in Numba. https://stackoverflow.com/a/70892395/4045774 But I guess that the alredy implemented carray https://numba.pydata.org/numba-doc/latest/reference/utils.html is enough to get it running. – max9111 May 16 '23 at 10:12
  • @JérômeRichard I figured out the problem. A structured numpy array `A` was being passed as an argument to my function. This function returned an element of `A`, which itself was a structured numpy array. I found a workaround where I now return something else as a proxy for that element. It works now. Should I also add this explanation as an answer here on the open GitHub issue (https://github.com/numba/numba/issues/6947)? – peakcipher May 16 '23 at 18:29
  • @max9111 I think you are probably right about what was happening. See the workaround I managed to do. – peakcipher May 16 '23 at 18:32

0 Answers0