pynndescent icon indicating copy to clipboard operation
pynndescent copied to clipboard

Problems with pynndescent > 0.2.1

Open lvoursl-zz opened this issue 6 years ago • 1 comments

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 "<string>", line 1, in <module>
  File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/__init__.py", line 3, in <module>
    from .pynndescent_ import NNDescent, PyNNDescentTransformer
  File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/pynndescent_.py", line 17, in <module>
    import pynndescent.threaded as threaded
  File "/home/yury.makarov/anaconda3/lib/python3.7/site-packages/pynndescent/threaded.py", line 60, in <module>
    @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(<function searchsorted at 0x7f78d97bcd08>) 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(<function _searchsorted.<locals>.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(<ufunc 'isnan'>) 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(<ufunc 'isnan'>)
[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):
        <source elided>
        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(<ufunc 'isnan'>) 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(<ufunc 'isnan'>)
[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):
        <source elided>
        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(<function _searchsorted.<locals>.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'):
            <source elided>
            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(<function searchsorted at 0x7f78d97bcd08>)
[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):
    <source elided>
    offsets = np.searchsorted(
        heap_updates[:num_heap_updates, 0], chunk_boundaries, side="left"
        ^

lvoursl-zz avatar Nov 05 '19 09:11 lvoursl-zz

I suspect you simply need a newer version of numba. It is possible that the requirements.txt and setup.py supply a slightly too old minimum version.

lmcinnes avatar Nov 06 '19 03:11 lmcinnes