lmcinnes / lmcinnes/pynndescent

Problems with pynndescent > 0.2.1

Open
#82 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
970
Forks
107
PR merge metrics
No merged PRs in 30d

Description

Hi!

I've a problems with pynndescent with version upper than 0.2.1.

My setup: Linux (Cent OS), conda 4.7.12, Python 3.7.3.

I'm trying to execute such simple code:
`python3 -c 'import pynndescent'`

And if I am using pynndescent with version upper than 0.2.1 I've the following error (it looks like a problem with numba):

```
Traceback (most recent call last):
File "", line 1, in
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/__init__.py", line 3, in
from .pynndescent_ import NNDescent, PyNNDescentTransformer
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/pynndescent_.py", line 17, in
import pynndescent.threaded as threaded
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/threaded.py", line 60, in
@numba.njit("i8[:](f4[:, :], i8, i8, i8)", nogil=True)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/decorators.py", line 183, in wrapper
disp.compile(sig)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py", line 658, in compile
cres = self._compiler.compile(args, return_type)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py", line 82, in compile
pipeline_class=self.pipeline_class)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 941, in compile_extra
return pipeline.compile_extra(func)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 372, in compile_extra
return self._compile_bytecode()
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 872, in _compile_bytecode
return self._compile_core()
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 859, in _compile_core
res = pm.run(self.status)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 253, in run
raise patched_exception
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 244, in run
stage()
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 500, in stage_nopython_frontend
self.locals)
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/compiler.py", line 1044, in type_inference_stage
infer.propagate()
File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py", line 861, in propagate
raise errors[0]
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function() with argument(s) of type(s): (array(float32, 1d, A), array(int64, 1d, C), side=Literal[str](left))
* parameterized
In definition 0:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(.searchsorted_inner at 0x7f7961c2e268>) with argument(s) of type(s): (array(float32, 1d, A), int64)
* parameterized
In definition 0:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function() with argument(s) of type(s): (int64)
* parameterized
In definition 0:
TypingError: ufunc 'isnan' using the loop 'l->?' not supported in this mode
raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:114
In definition 1:
TypingError: ufunc 'isnan' using the loop 'l->?' not supported in this mode
raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:114
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function()
[2] During: typing of call at /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py (2884)

File "anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2884:
def searchsorted_inner(a, v):

n = len(a)
if np.isnan(v):

^

raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py:861
In definition 1:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function() with argument(s) of type(s): (int64)
* parameterized
In definition 0:
TypingError: ufunc 'isnan' using the loop 'l->?' not supported in this mode
raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:114
In definition 1:
TypingError: ufunc 'isnan' using the loop 'l->?' not supported in this mode
raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:114
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function()
[2] During: typing of call at /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py (2884)

File "anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2884:
def searchsorted_inner(a, v):

n = len(a)
if np.isnan(v):
^

raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py:861
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(.searchsorted_inner at 0x7f7961c2e268>)
[2] During: typing of call at /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py (2924)

File "anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2924:
def searchsorted_impl(a, v, side='left'):

for view, outview in np.nditer((v, out)):
index = loop_impl(a, view.item())
^

raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py:861
In definition 1:
ValueError: Invalid value given for 'side': unicode_type
raised from /home/yury.makarov/anaconda3/lib/python3.7/site-packages/numba/targets/arraymath.py:2917
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function()
[2] During: typing of call at /home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/threaded.py (67)

File "anaconda3/lib/python3.7/site-packages/pynndescent/threaded.py", line 67:
def chunk_heap_updates(heap_updates, num_heap_updates, n_vertices, chunk_size):

offsets = np.searchsorted(
heap_updates[:num_heap_updates, 0], chunk_boundaries, side="left"
^
````

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 `python3 -c 'import pynndescent'` using the reported Linux, Python 3.7.3, and pynndescent versions above 0.2.1. Start at `pynndescent/threaded.py` line 67 and trace the import path through `pynndescent/__init__.py` and `pynndescent/pynndescent_.py`; done means the affected installation imports without this Numba typing error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.