lmcinnes / lmcinnes/umap

Unknown import issue

Open
#844 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

Hi,

When I import umap, it raises the typeerror as below, can anyone tell me how to address this?

Thanks,
Xinye


TypeError Traceback (most recent call last)
~/.local/lib/python3.9/site-packages/numba/core/errors.py in new_error_context(fmt_, *args, **kwargs)
775 try:
--> 776 yield
777 except NumbaError as e:

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_block(self, block)
234 loc=self.loc, errcls_=defaulterrcls):
--> 235 self.lower_inst(inst)
236 self.post_block(block)

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_inst(self, inst)
379 ty = self.typeof(inst.target.name)
--> 380 val = self.lower_assign(ty, inst)
381 self.storevar(val, inst.target.name)

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_assign(self, ty, inst)
555 elif isinstance(value, ir.Expr):
--> 556 return self.lower_expr(ty, value)
557

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_expr(self, resty, expr)
1083 elif expr.op == 'call':
-> 1084 res = self.lower_call(resty, expr)
1085 return res

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_call(self, resty, expr)
814 else:
--> 815 res = self._lower_call_normal(fnty, expr, signature)
816

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in _lower_call_normal(self, fnty, expr, signature)
1054
-> 1055 res = impl(self.builder, argvals, self.loc)
1056 return res

~/.local/lib/python3.9/site-packages/numba/core/base.py in call(self, builder, args, loc)
1193 def call(self, builder, args, loc=None):
-> 1194 res = self._imp(self._context, builder, self._sig, args, loc=loc)
1195 self._context.add_linking_libs(getattr(self, 'libs', ()))

~/.local/lib/python3.9/site-packages/numba/core/base.py in wrapper(*args, **kwargs)
1223 kwargs.pop('loc') # drop unused loc
-> 1224 return fn(*args, **kwargs)
1225

~/.local/lib/python3.9/site-packages/numba/cpython/rangeobj.py in range1_impl(context, builder, sig, args)
39 state.start = context.get_constant(int_type, 0)
---> 40 state.stop = stop
41 state.step = context.get_constant(int_type, 1)

~/.local/lib/python3.9/site-packages/numba/core/cgutils.py in setattr(self, field, value)
163 return super(_StructProxy, self).setattr(field, value)
--> 164 self[self._datamodel.get_field_position(field)] = value
165

~/.local/lib/python3.9/site-packages/numba/core/cgutils.py in setitem(self, index, value)
187 else:
--> 188 raise TypeError("Invalid store of {value.type} to "
189 "{ptr.type.pointee} in "

TypeError: Invalid store of i64 to i32 in <numba.core.datamodel.models.RangeModel object at 0x7fd7d57a6040> (trying to write member #1)

During handling of the above exception, another exception occurred:

LoweringError Traceback (most recent call last)
in
----> 1 import umap

/usr/lib/python3/dist-packages/umap/init.py in
----> 1 from .umap_ import UMAP
2
3 # Workaround: https://github.com/numba/numba/issues/3341
4 import numba
5

/usr/lib/python3/dist-packages/umap/umap_.py in
52 from umap.spectral import spectral_layout
53 from umap.utils import deheap_sort, submatrix
---> 54 from umap.layouts import (
55 optimize_layout_euclidean,
56 optimize_layout_generic,

/usr/lib/python3/dist-packages/umap/layouts.py in
37 },
38 )
---> 39 def rdist(x, y):
40 """Reduced Euclidean distance.
41

~/.local/lib/python3.9/site-packages/numba/core/decorators.py in wrapper(func)
224 with typeinfer.register_dispatcher(disp):
225 for sig in sigs:
--> 226 disp.compile(sig)
227 disp.disable_compile()
228 return disp

~/.local/lib/python3.9/site-packages/numba/core/dispatcher.py in compile(self, sig)
977 with ev.trigger_event("numba:compile", data=ev_details):
978 try:
--> 979 cres = self._compiler.compile(args, return_type)
980 except errors.ForceLiteralArg as e:
981 def folded(args, kws):

~/.local/lib/python3.9/site-packages/numba/core/dispatcher.py in compile(self, args, return_type)
139
140 def compile(self, args, return_type):
--> 141 status, retval = self._compile_cached(args, return_type)
142 if status:
143 return retval

~/.local/lib/python3.9/site-packages/numba/core/dispatcher.py in _compile_cached(self, args, return_type)
153
154 try:
--> 155 retval = self._compile_core(args, return_type)
156 except errors.TypingError as e:
157 self._failed_cache[key] = e

~/.local/lib/python3.9/site-packages/numba/core/dispatcher.py in _compile_core(self, args, return_type)
166
167 impl = self._get_implementation(args, {})
--> 168 cres = compiler.compile_extra(self.targetdescr.typing_context,
169 self.targetdescr.target_context,
170 impl,

~/.local/lib/python3.9/site-packages/numba/core/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
684 pipeline = pipeline_class(typingctx, targetctx, library,
685 args, return_type, flags, locals)
--> 686 return pipeline.compile_extra(func)
687
688

~/.local/lib/python3.9/site-packages/numba/core/compiler.py in compile_extra(self, func)
426 self.state.lifted = ()
427 self.state.lifted_from = None
--> 428 return self._compile_bytecode()
429
430 def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~/.local/lib/python3.9/site-packages/numba/core/compiler.py in _compile_bytecode(self)
490 """
491 assert self.state.func_ir is None
--> 492 return self._compile_core()
493
494 def _compile_ir(self):

~/.local/lib/python3.9/site-packages/numba/core/compiler.py in _compile_core(self)
469 self.state.status.fail_reason = e
470 if is_final_pipeline:
--> 471 raise e
472 else:
473 raise CompilerError("All available pipelines exhausted")

~/.local/lib/python3.9/site-packages/numba/core/compiler.py in _compile_core(self)
460 res = None
461 try:
--> 462 pm.run(self.state)
463 if self.state.cr is not None:
464 break

~/.local/lib/python3.9/site-packages/numba/core/compiler_machinery.py in run(self, state)
341 (self.pipeline_name, pass_desc)
342 patched_exception = self._patch_error(msg, e)
--> 343 raise patched_exception
344
345 def dependency_analysis(self):

~/.local/lib/python3.9/site-packages/numba/core/compiler_machinery.py in run(self, state)
332 pass_inst = _pass_registry.get(pss).pass_inst
333 if isinstance(pass_inst, CompilerPass):
--> 334 self._runPass(idx, pass_inst, state)
335 else:
336 raise BaseException("Legacy pass in use")

~/.local/lib/python3.9/site-packages/numba/core/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
33 def _acquire_compile_lock(*args, **kwargs):
34 with self:
---> 35 return func(*args, **kwargs)
36 return _acquire_compile_lock
37

~/.local/lib/python3.9/site-packages/numba/core/compiler_machinery.py in _runPass(self, index, pss, internal_state)
287 mutated |= check(pss.run_initialization, internal_state)
288 with SimpleTimer() as pass_time:
--> 289 mutated |= check(pss.run_pass, internal_state)
290 with SimpleTimer() as finalize_time:
291 mutated |= check(pss.run_finalizer, internal_state)

~/.local/lib/python3.9/site-packages/numba/core/compiler_machinery.py in check(func, compiler_state)
260
261 def check(func, compiler_state):
--> 262 mangled = func(compiler_state)
263 if mangled not in (True, False):
264 msg = ("CompilerPass implementations should return True/False. "

~/.local/lib/python3.9/site-packages/numba/core/typed_passes.py in run_pass(self, state)
394 lower = lowering.Lower(targetctx, library, fndesc, interp,
395 metadata=metadata)
--> 396 lower.lower()
397 if not flags.no_cpython_wrapper:
398 lower.create_cpython_wrapper(flags.release_gil)

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower(self)
136 if self.generator_info is None:
137 self.genlower = None
--> 138 self.lower_normal_function(self.fndesc)
139 else:
140 self.genlower = self.GeneratorLower(self)

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_normal_function(self, fndesc)
190 # Init argument values
191 self.extract_function_arguments()
--> 192 entry_block_tail = self.lower_function_body()
193
194 # Close tail of entry block, do not emit debug metadata else the

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_function_body(self)
219 bb = self.blkmap[offset]
220 self.builder.position_at_end(bb)
--> 221 self.lower_block(block)
222 self.post_lower()
223 return entry_block_tail

~/.local/lib/python3.9/site-packages/numba/core/lowering.py in lower_block(self, block)
233 with new_error_context('lowering "{inst}" at {loc}', inst=inst,
234 loc=self.loc, errcls_=defaulterrcls):
--> 235 self.lower_inst(inst)
236 self.post_block(block)
237

/usr/lib/python3.9/contextlib.py in exit(self, type, value, traceback)
133 value = type()
134 try:
--> 135 self.gen.throw(type, value, traceback)
136 except StopIteration as exc:
137 # Suppress StopIteration unless it's the same exception that

~/.local/lib/python3.9/site-packages/numba/core/errors.py in new_error_context(fmt_, *args, **kwargs)
784 newerr = errcls(e).add_context(format_msg(fmt, args, kwargs))
785 tb = sys.exc_info()[2] if numba.core.config.FULL_TRACEBACKS else None
--> 786 raise newerr.with_traceback(tb)
787
788

LoweringError: Failed in nopython mode pipeline (step: native lowering)
Invalid store of i64 to i32 in <numba.core.datamodel.models.RangeModel object at 0x7fd7d57a6040> (trying to write member #1)

File "../../../../../../usr/lib/python3/dist-packages/umap/layouts.py", line 53:
def rdist(x, y):

dim = x.shape[0]
for i in range(dim):
^

During: lowering "$20call_function.7 = call $16load_global.5(dim, func=$16load_global.5, args=[Var(dim, layouts.py:52)], kws=(), vararg=None, target=None)" at /usr/lib/python3/dist-packages/umap/layouts.py (53)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with import umap under the reported Python 3.9 environment, then start by reading umap/__init__.py, umap/umap_.py, and umap/layouts.py alongside the traceback. Compare the installed UMAP and Numba versions and determine the project-side change needed so the import completes without the reported LoweringError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.