Skip to content

Instantly share code, notes, and snippets.

@ivirshup
Created September 2, 2019 01:41
Show Gist options
  • Select an option

  • Save ivirshup/50c966dd031a89b9bde055403aadb09e to your computer and use it in GitHub Desktop.

Select an option

Save ivirshup/50c966dd031a89b9bde055403aadb09e to your computer and use it in GitHub Desktop.
Full numba traceback for trying to call `list(x)` where x is numpy array of unicode
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs)
661 try:
--> 662 yield
663 except NumbaError as e:
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block)
257 loc=self.loc, errcls_=defaulterrcls):
--> 258 self.lower_inst(inst)
259
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_inst(self, inst)
300 ty = self.typeof(inst.target.name)
--> 301 val = self.lower_assign(ty, inst)
302 self.storevar(val, inst.target.name)
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_assign(self, ty, inst)
458 elif isinstance(value, ir.Expr):
--> 459 return self.lower_expr(ty, value)
460
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_expr(self, resty, expr)
1061 for val, fromty in zip(itemvals, itemtys)]
-> 1062 return self.context.build_list(self.builder, resty, castvals)
1063
/usr/local/lib/python3.7/site-packages/numba/targets/cpu.py in build_list(self, builder, list_type, items)
123 """
--> 124 return listobj.build_list(self, builder, list_type, items)
125
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in build_list(context, builder, list_type, items)
450 nitems = len(items)
--> 451 inst = ListInstance.allocate(context, builder, list_type, nitems)
452 # Populate list
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in allocate(cls, context, builder, list_type, nitems)
318 """
--> 319 ok, self = cls.allocate_ex(context, builder, list_type, nitems)
320 with builder.if_then(builder.not_(ok), likely=False):
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in allocate_ex(cls, context, builder, list_type, nitems)
255 meminfo = context.nrt.meminfo_new_varsize_dtor(
--> 256 builder, size=allocsize, dtor=self.get_dtor())
257 with builder.if_else(cgutils.is_null(builder, meminfo),
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in get_dtor(self)
306 # Define and set the Dtor
--> 307 dtor = self.define_dtor()
308 dtor_fnptr = self._builder.bitcast(dtor, cgutils.voidptr_t)
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in define_dtor(self)
295 intp=intp) as (idx, _):
--> 296 val = payload.getitem(idx)
297 context.nrt.decref(builder, self.dtype, val)
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in getitem(self, idx)
63 data_item = self._builder.load(ptr)
---> 64 return self._datamodel.from_data(self._builder, data_item)
65
/usr/local/lib/python3.7/site-packages/numba/datamodel/models.py in from_data(self, builder, value)
69 def from_data(self, builder, value):
---> 70 raise NotImplementedError(self)
71
NotImplementedError: <numba.datamodel.models.UnicodeCharSeq object at 0x11cf670f0>
During handling of the above exception, another exception occurred:
LoweringError Traceback (most recent call last)
<ipython-input-33-9e7dcc2e4874> in <module>
----> 1 type(foo2(np.array(list("abc"))))
/usr/local/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
393 e.patch_message(''.join(e.args) + help_msg)
394 # ignore the FULL_TRACEBACKS config, this needs reporting!
--> 395 raise e
396
397 def inspect_llvm(self, signature=None):
/usr/local/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
350 argtypes.append(self.typeof_pyval(a))
351 try:
--> 352 return self.compile(tuple(argtypes))
353 except errors.TypingError as e:
354 # Intercept typing error that may be due to an argument
/usr/local/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34
/usr/local/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig)
691
692 self._cache_misses[sig] += 1
--> 693 cres = self._compiler.compile(args, return_type)
694 self.add_overload(cres)
695 self._cache.save_overload(sig, cres)
/usr/local/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type)
74
75 def compile(self, args, return_type):
---> 76 status, retval = self._compile_cached(args, return_type)
77 if status:
78 return retval
/usr/local/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type)
88
89 try:
---> 90 retval = self._compile_core(args, return_type)
91 except errors.TypingError as e:
92 self._failed_cache[key] = e
/usr/local/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type)
106 args=args, return_type=return_type,
107 flags=flags, locals=self.locals,
--> 108 pipeline_class=self.pipeline_class)
109 # Check typing error if object mode is used
110 if cres.typing_error is not None and not flags.enable_pyobject:
/usr/local/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
970 pipeline = pipeline_class(typingctx, targetctx, library,
971 args, return_type, flags, locals)
--> 972 return pipeline.compile_extra(func)
973
974
/usr/local/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func)
388 self.lifted = ()
389 self.lifted_from = None
--> 390 return self._compile_bytecode()
391
392 def compile_ir(self, func_ir, lifted=(), lifted_from=None):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self)
901 """
902 assert self.func_ir is None
--> 903 return self._compile_core()
904
905 def _compile_ir(self):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
888 self.define_pipelines(pm)
889 pm.finalize()
--> 890 res = pm.run(self.status)
891 if res is not None:
892 # Early pipeline completion
/usr/local/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34
/usr/local/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
264 # No more fallback pipelines?
265 if is_final_pipeline:
--> 266 raise patched_exception
267 # Go to next fallback pipeline
268 else:
/usr/local/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
255 try:
256 event("-- %s" % stage_name)
--> 257 stage()
258 except _EarlyPipelineCompletion as e:
259 return e.result
/usr/local/lib/python3.7/site-packages/numba/compiler.py in stage_nopython_backend(self)
762 """
763 lowerfn = self.backend_nopython_mode
--> 764 self._backend(lowerfn, objectmode=False)
765
766 def stage_compile_interp_mode(self):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in _backend(self, lowerfn, objectmode)
701 self.library.enable_object_caching()
702
--> 703 lowered = lowerfn()
704 signature = typing.signature(self.return_type, *self.args)
705 self.cr = compile_result(
/usr/local/lib/python3.7/site-packages/numba/compiler.py in backend_nopython_mode(self)
688 self.calltypes,
689 self.flags,
--> 690 self.metadata)
691
692 def _backend(self, lowerfn, objectmode):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in native_lowering_stage(targetctx, library, interp, typemap, restype, calltypes, flags, metadata)
1141 lower = lowering.Lower(targetctx, library, fndesc, interp,
1142 metadata=metadata)
-> 1143 lower.lower()
1144 if not flags.no_cpython_wrapper:
1145 lower.create_cpython_wrapper(flags.release_gil)
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower(self)
175 if self.generator_info is None:
176 self.genlower = None
--> 177 self.lower_normal_function(self.fndesc)
178 else:
179 self.genlower = self.GeneratorLower(self)
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_normal_function(self, fndesc)
216 # Init argument values
217 self.extract_function_arguments()
--> 218 entry_block_tail = self.lower_function_body()
219
220 # Close tail of entry block
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_function_body(self)
241 bb = self.blkmap[offset]
242 self.builder.position_at_end(bb)
--> 243 self.lower_block(block)
244
245 self.post_lower()
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block)
256 with new_error_context('lowering "{inst}" at {loc}', inst=inst,
257 loc=self.loc, errcls_=defaulterrcls):
--> 258 self.lower_inst(inst)
259
260 def create_cpython_wrapper(self, release_gil=False):
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_inst(self, inst)
299 if isinstance(inst, ir.Assign):
300 ty = self.typeof(inst.target.name)
--> 301 val = self.lower_assign(ty, inst)
302 self.storevar(val, inst.target.name)
303
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_assign(self, ty, inst)
457
458 elif isinstance(value, ir.Expr):
--> 459 return self.lower_expr(ty, value)
460
461 elif isinstance(value, ir.Var):
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_expr(self, resty, expr)
917
918 elif expr.op == 'call':
--> 919 res = self.lower_call(resty, expr)
920 return res
921
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_call(self, resty, expr)
709
710 else:
--> 711 res = self._lower_call_normal(fnty, expr, signature)
712
713 # If lowering the call returned None, interpret that as returning dummy
/usr/local/lib/python3.7/site-packages/numba/lowering.py in _lower_call_normal(self, fnty, expr, signature)
888 argvals = [the_self] + list(argvals)
889
--> 890 res = impl(self.builder, argvals, self.loc)
891 return res
892
/usr/local/lib/python3.7/site-packages/numba/targets/base.py in __call__(self, builder, args, loc)
1130
1131 def __call__(self, builder, args, loc=None):
-> 1132 res = self._imp(self._context, builder, self._sig, args, loc=loc)
1133 self._context.add_linking_libs(getattr(self, 'libs', ()))
1134 return res
/usr/local/lib/python3.7/site-packages/numba/targets/base.py in wrapper(*args, **kwargs)
1155 def wrapper(*args, **kwargs):
1156 kwargs.pop('loc') # drop unused loc
-> 1157 return fn(*args, **kwargs)
1158
1159 # Copy the following attributes from the wrapped.
/usr/local/lib/python3.7/site-packages/numba/targets/listobj.py in list_constructor(context, builder, sig, args)
466 return res
467
--> 468 return context.compile_internal(builder, list_impl, sig, args)
469
470 @lower_builtin(list)
/usr/local/lib/python3.7/site-packages/numba/targets/base.py in compile_internal(self, builder, impl, sig, args, locals)
857 *args*.
858 """
--> 859 cres = self.compile_subroutine(builder, impl, sig, locals)
860 return self.call_internal(builder, cres.fndesc, sig, args)
861
/usr/local/lib/python3.7/site-packages/numba/targets/base.py in compile_subroutine(self, builder, impl, sig, locals, flags, caching)
844 cres = self._compile_subroutine_no_cache(builder, impl, sig,
845 locals=locals,
--> 846 flags=flags)
847 self.cached_internal_func[cache_key] = cres
848
/usr/local/lib/python3.7/site-packages/numba/targets/base.py in _compile_subroutine_no_cache(self, builder, impl, sig, locals, flags)
817 impl, sig.args,
818 sig.return_type, flags,
--> 819 locals=locals)
820
821 # Allow inlining the function inside callers.
/usr/local/lib/python3.7/site-packages/numba/compiler.py in compile_internal(typingctx, targetctx, library, func, args, return_type, flags, locals)
1044 pipeline = Pipeline(typingctx, targetctx, library,
1045 args, return_type, flags, locals)
-> 1046 return pipeline.compile_extra(func)
1047
1048
/usr/local/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func)
388 self.lifted = ()
389 self.lifted_from = None
--> 390 return self._compile_bytecode()
391
392 def compile_ir(self, func_ir, lifted=(), lifted_from=None):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self)
901 """
902 assert self.func_ir is None
--> 903 return self._compile_core()
904
905 def _compile_ir(self):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
888 self.define_pipelines(pm)
889 pm.finalize()
--> 890 res = pm.run(self.status)
891 if res is not None:
892 # Early pipeline completion
/usr/local/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
30 def _acquire_compile_lock(*args, **kwargs):
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock
34
/usr/local/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
264 # No more fallback pipelines?
265 if is_final_pipeline:
--> 266 raise patched_exception
267 # Go to next fallback pipeline
268 else:
/usr/local/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
255 try:
256 event("-- %s" % stage_name)
--> 257 stage()
258 except _EarlyPipelineCompletion as e:
259 return e.result
/usr/local/lib/python3.7/site-packages/numba/compiler.py in stage_nopython_backend(self)
762 """
763 lowerfn = self.backend_nopython_mode
--> 764 self._backend(lowerfn, objectmode=False)
765
766 def stage_compile_interp_mode(self):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in _backend(self, lowerfn, objectmode)
701 self.library.enable_object_caching()
702
--> 703 lowered = lowerfn()
704 signature = typing.signature(self.return_type, *self.args)
705 self.cr = compile_result(
/usr/local/lib/python3.7/site-packages/numba/compiler.py in backend_nopython_mode(self)
688 self.calltypes,
689 self.flags,
--> 690 self.metadata)
691
692 def _backend(self, lowerfn, objectmode):
/usr/local/lib/python3.7/site-packages/numba/compiler.py in native_lowering_stage(targetctx, library, interp, typemap, restype, calltypes, flags, metadata)
1141 lower = lowering.Lower(targetctx, library, fndesc, interp,
1142 metadata=metadata)
-> 1143 lower.lower()
1144 if not flags.no_cpython_wrapper:
1145 lower.create_cpython_wrapper(flags.release_gil)
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower(self)
175 if self.generator_info is None:
176 self.genlower = None
--> 177 self.lower_normal_function(self.fndesc)
178 else:
179 self.genlower = self.GeneratorLower(self)
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_normal_function(self, fndesc)
216 # Init argument values
217 self.extract_function_arguments()
--> 218 entry_block_tail = self.lower_function_body()
219
220 # Close tail of entry block
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_function_body(self)
241 bb = self.blkmap[offset]
242 self.builder.position_at_end(bb)
--> 243 self.lower_block(block)
244
245 self.post_lower()
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block)
256 with new_error_context('lowering "{inst}" at {loc}', inst=inst,
257 loc=self.loc, errcls_=defaulterrcls):
--> 258 self.lower_inst(inst)
259
260 def create_cpython_wrapper(self, release_gil=False):
/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback)
128 value = type()
129 try:
--> 130 self.gen.throw(type, value, traceback)
131 except StopIteration as exc:
132 # Suppress StopIteration *unless* it's the same exception that
/usr/local/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs)
668 from numba import config
669 tb = sys.exc_info()[2] if config.FULL_TRACEBACKS else None
--> 670 six.reraise(type(newerr), newerr, tb)
671
672
/usr/local/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb)
657 if value.__traceback__ is not tb:
658 raise value.with_traceback(tb)
--> 659 raise value
660
661 else:
LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
Failed in nopython mode pipeline (step: nopython mode backend)
<numba.datamodel.models.UnicodeCharSeq object at 0x11cf670f0>
File "../../../../usr/local/lib/python3.7/site-packages/numba/targets/listobj.py", line 464:
def list_impl(iterable):
res = []
^
[1] During: lowering "$0.1 = build_list(items=[])" at /usr/local/lib/python3.7/site-packages/numba/targets/listobj.py (464)
[2] During: lowering "$0.3 = call $0.1(x, func=$0.1, args=[Var(x, <ipython-input-30-e93183b126c2> (3))], kws=(), vararg=None)" at <ipython-input-30-e93183b126c2> (3)
-------------------------------------------------------------------------------
This should not have happened, a problem has occurred in Numba's internals.
You are currently using Numba version 0.45.1.
Please report the error message and traceback, along with a minimal reproducer
at: https://github.com/numba/numba/issues/new
If more help is needed please feel free to speak to the Numba core developers
directly at: https://gitter.im/numba/numba
Thanks in advance for your help in improving Numba!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment