Package: python3-pynndescent
Version: 0.5.7-1
Severity: serious

Dear Debian Python Team,

in the python3 or ipython3 interpreter, the Python statement

   import pynndescent.sparse as sparse

fails and the output in ipython3 is
```
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
Cell In [1], line 1
----> 1 import pynndescent.sparse as sparse

File /usr/lib/python3/dist-packages/pynndescent/__init__.py:3
      1 import pkg_resources
      2 import numba
----> 3 from .pynndescent_ import NNDescent, PyNNDescentTransformer
      5 # Workaround: https://github.com/numba/numba/issues/3341
      6 if numba.config.THREADING_LAYER == "omp":

File /usr/lib/python3/dist-packages/pynndescent/pynndescent_.py:16
     12 from scipy.sparse import csr_matrix, coo_matrix, isspmatrix_csr, vstack
as sparse_vstack, issparse
     14 import heapq
---> 16 import pynndescent.sparse as sparse
     17 import pynndescent.sparse_nndescent as sparse_nnd
     18 import pynndescent.distances as pynnd_dist

File /usr/lib/python3/dist-packages/pynndescent/sparse.py:381
    377         result += aux_data[i] ** 2
    378     return np.sqrt(result)
--> 381 @numba.njit(
    382     [
    383         "f4(i4[::1],f4[::1],i4[::1],f4[::1])",
    384         numba.types.float32(
    385             numba.types.Array(numba.types.int32, 1, "C", readonly=True),
    386             numba.types.Array(numba.types.float32, 1, "C", 
readonly=True),
    387             numba.types.Array(numba.types.int32, 1, "C", readonly=True),
    388             numba.types.Array(numba.types.float32, 1, "C", 
readonly=True),
    389         ),
    390     ],
    391     fastmath=True,
    392     locals={
    393         "aux_data": numba.types.float32[::1],
    394         "result": numba.types.float32,
    395         "diff": numba.types.float32,
    396         "dim": numba.types.intp,
    397         "i": numba.types.uint16,
    398     },
    399 )
    400 def sparse_squared_euclidean(ind1, data1, ind2, data2):
    401     _, aux_data = sparse_diff(ind1, data1, ind2, data2)
    402     result = 0.0

File /usr/lib/python3/dist-packages/numba/core/decorators.py:219, in
_jit.<locals>.wrapper(func)
    217     with typeinfer.register_dispatcher(disp):
    218         for sig in sigs:
--> 219             disp.compile(sig)
    220         disp.disable_compile()
    221 return disp

File /usr/lib/python3/dist-packages/numba/core/dispatcher.py:965, in
Dispatcher.compile(self, sig)
    963 with ev.trigger_event("numba:compile", data=ev_details):
    964     try:
--> 965         cres = self._compiler.compile(args, return_type)
    966     except errors.ForceLiteralArg as e:
    967         def folded(args, kws):

File /usr/lib/python3/dist-packages/numba/core/dispatcher.py:129, in
_FunctionCompiler.compile(self, args, return_type)
    127     return retval
    128 else:
--> 129     raise retval

File /usr/lib/python3/dist-packages/numba/core/dispatcher.py:139, in
_FunctionCompiler._compile_cached(self, args, return_type)
    136     pass
    138 try:
--> 139     retval = self._compile_core(args, return_type)
    140 except errors.TypingError as e:
    141     self._failed_cache[key] = e

File /usr/lib/python3/dist-packages/numba/core/dispatcher.py:152, in
_FunctionCompiler._compile_core(self, args, return_type)
    149 flags = self._customize_flags(flags)
    151 impl = self._get_implementation(args, {})
--> 152 cres = compiler.compile_extra(self.targetdescr.typing_context,
    153                               self.targetdescr.target_context,
    154                               impl,
    155                               args=args, return_type=return_type,
    156                               flags=flags, locals=self.locals,
    157                               pipeline_class=self.pipeline_class)
    158 # Check typing error if object mode is used
    159 if cres.typing_error is not None and not flags.enable_pyobject:

File /usr/lib/python3/dist-packages/numba/core/compiler.py:716, in
compile_extra(typingctx, targetctx, func, args, return_type, flags, locals,
library, pipeline_class)
    692 """Compiler entry point
    693
    694 Parameter
   (...)
    712     compiler pipeline
    713 """
    714 pipeline = pipeline_class(typingctx, targetctx, library,
    715                           args, return_type, flags, locals)
--> 716 return pipeline.compile_extra(func)

File /usr/lib/python3/dist-packages/numba/core/compiler.py:452, in
CompilerBase.compile_extra(self, func)
    450 self.state.lifted = ()
    451 self.state.lifted_from = None
--> 452 return self._compile_bytecode()

File /usr/lib/python3/dist-packages/numba/core/compiler.py:520, in
CompilerBase._compile_bytecode(self)
    516 """
    517 Populate and run pipeline for bytecode input
    518 """
    519 assert self.state.func_ir is None
--> 520 return self._compile_core()

File /usr/lib/python3/dist-packages/numba/core/compiler.py:499, in
CompilerBase._compile_core(self)
    497         self.state.status.fail_reason = e
    498         if is_final_pipeline:
--> 499             raise e
    500 else:
    501     raise CompilerError("All available pipelines exhausted")

File /usr/lib/python3/dist-packages/numba/core/compiler.py:486, in
CompilerBase._compile_core(self)
    484 res = None
    485 try:
--> 486     pm.run(self.state)
    487     if self.state.cr is not None:
    488         break

File /usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:368, in
PassManager.run(self, state)
    365 msg = "Failed in %s mode pipeline (step: %s)" % \
    366     (self.pipeline_name, pass_desc)
    367 patched_exception = self._patch_error(msg, e)
--> 368 raise patched_exception

File /usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:356, in
PassManager.run(self, state)
    354 pass_inst = _pass_registry.get(pss).pass_inst
    355 if isinstance(pass_inst, CompilerPass):
--> 356     self._runPass(idx, pass_inst, state)
    357 else:
    358     raise BaseException("Legacy pass in use")

File /usr/lib/python3/dist-packages/numba/core/compiler_lock.py:35, in
_CompilerLock.__call__.<locals>._acquire_compile_lock(*args, **kwargs)
     32 @functools.wraps(func)
     33 def _acquire_compile_lock(*args, **kwargs):
     34     with self:
---> 35         return func(*args, **kwargs)

File /usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:311, in
PassManager._runPass(self, index, pss, internal_state)
    309     mutated |= check(pss.run_initialization, internal_state)
    310 with SimpleTimer() as pass_time:
--> 311     mutated |= check(pss.run_pass, internal_state)
    312 with SimpleTimer() as finalize_time:
    313     mutated |= check(pss.run_finalizer, internal_state)

File /usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:273, in
PassManager._runPass.<locals>.check(func, compiler_state)
    272 def check(func, compiler_state):
--> 273     mangled = func(compiler_state)
    274     if mangled not in (True, False):
    275         msg = ("CompilerPass implementations should return True/False. "
    276                "CompilerPass with name '%s' did not.")

File /usr/lib/python3/dist-packages/numba/core/typed_passes.py:105, in
BaseTypeInference.run_pass(self, state)
     99 """
    100 Type inference and legalization
    101 """
    102 with fallback_context(state, 'Function "%s" failed type inference'
    103                       % (state.func_id.func_name,)):
    104     # Type inference
--> 105     typemap, return_type, calltypes, errs = type_inference_stage(
    106         state.typingctx,
    107         state.targetctx,
    108         state.func_ir,
    109         state.args,
    110         state.return_type,
    111         state.locals,
    112         raise_errors=self._raise_errors)
    113     state.typemap = typemap
    114     # save errors in case of partial typing

File /usr/lib/python3/dist-packages/numba/core/typed_passes.py:83, in
type_inference_stage(typingctx, targetctx, interp, args, return_type, locals,
raise_errors)
     81     infer.build_constraint()
     82     # return errors in case of partial typing
---> 83     errs = infer.propagate(raise_errors=raise_errors)
     84     typemap, restype, calltypes = infer.unify(raise_errors=raise_errors)
     86 # Output all Numba warnings

File /usr/lib/python3/dist-packages/numba/core/typeinfer.py:1086, in
TypeInferer.propagate(self, raise_errors)
   1083 force_lit_args = [e for e in errors
   1084                   if isinstance(e, ForceLiteralArg)]
   1085 if not force_lit_args:
-> 1086     raise errors[0]
   1087 else:
   1088     raise reduce(operator.or_, force_lit_args)

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Internal error at <numba.core.typeinfer.CallConstraint object at 
0x7fa880d3f550>.
Failed in nopython mode pipeline (step: native lowering)
AST node line range (200, 1) is not valid

File "../../usr/lib/python3/dist-packages/pynndescent/sparse.py", line 202:
def sparse_diff(ind1, data1, ind2, data2):
    return sparse_sum(ind1, data1, ind2, -data2)
    ^

During: lowering "$24unary_negative.6 = arrayexpr(expr=(<built-in function neg>,
[Var(data2, sparse.py:200)]), ty=array(float32, 1d, C))" at
/usr/lib/python3/dist-packages/pynndescent/sparse.py (202)
During: resolving callee type: type(CPUDispatcher(<function sparse_diff at
0x7fa881010680>))
During: typing of call at /usr/lib/python3/dist-packages/pynndescent/sparse.py 
(401)

Enable logging at debug level for details.

File "../../usr/lib/python3/dist-packages/pynndescent/sparse.py", line 401:
def sparse_squared_euclidean(ind1, data1, ind2, data2):
    _, aux_data = sparse_diff(ind1, data1, ind2, data2)
    ^
```

I'm not sure if the failure is due to this package or the package
python3-numba.
Or is this just a Python 3.11 transition outfall?

Any help appreciated.

Regards,
Jörg.


-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (600, 'testing'), (500, 'unstable'), (5, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.4 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=C.utf8, LC_CTYPE=C.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages python3-pynndescent depends on:
ii  python3           3.11.1-1
ii  python3-joblib    1.2.0-4
ii  python3-llvmlite  0.39.1-2
ii  python3-numba     0.56.4+dfsg-1
ii  python3-scipy     1.8.1-20
ii  python3-sklearn   1.1.2+dfsg-92

python3-pynndescent recommends no packages.

python3-pynndescent suggests no packages.

-- no debconf information

Reply via email to