question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility with numpy 1.17

See original GitHub issue

I’ve pulled down the latest master (but the issue is already present in the latest release on both PyPI and conda-forge), using the latest version of numpy 1.17.0, and get the following error on import:

Python 3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynndescent
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pavlin/dev/pynndescent/pynndescent/__init__.py", line 3, in <module>
    from .pynndescent_ import NNDescent, PyNNDescentTransformer
  File "/home/pavlin/dev/pynndescent/pynndescent/pynndescent_.py", line 17, in <module>
    import pynndescent.threaded as threaded
  File "/home/pavlin/dev/pynndescent/pynndescent/threaded.py", line 60, in <module>
    @numba.njit("i8[:](f4[:, :], i8, i8, i8)", nogil=True)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/decorators.py", line 186, in wrapper
    disp.compile(sig)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/dispatcher.py", line 659, in compile
    cres = self._compiler.compile(args, return_type)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/dispatcher.py", line 83, in compile
    pipeline_class=self.pipeline_class)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 955, in compile_extra
    return pipeline.compile_extra(func)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 377, in compile_extra
    return self._compile_bytecode()
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 886, in _compile_bytecode
    return self._compile_core()
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 873, in _compile_core
    res = pm.run(self.status)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 254, in run
    raise patched_exception
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 245, in run
    stage()
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 501, in stage_nopython_frontend
    self.locals)
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/compiler.py", line 1105, in type_inference_stage
    infer.propagate()
  File "/home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/typeinfer.py", line 915, in propagate
    raise errors[0]
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<function searchsorted at 0x7fbd99cb17b8>) 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 0x7fbd92639950>) 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/pavlin/miniconda3/envs/tmp/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/pavlin/miniconda3/envs/tmp/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/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py (2996)


File "../../miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2996:
    def searchsorted_inner(a, v):
        <source elided>
        n = len(a)
        if np.isnan(v):
        ^

    raised from /home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/typeinfer.py:915
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/pavlin/miniconda3/envs/tmp/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/pavlin/miniconda3/envs/tmp/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/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py (2996)


File "../../miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py", line 2996:
    def searchsorted_inner(a, v):
        <source elided>
        n = len(a)
        if np.isnan(v):
        ^

    raised from /home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/typeinfer.py:915
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 0x7fbd92639950>)
[2] During: typing of call at /home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py (3036)


File "../../miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py", line 3036:
        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/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/typeinfer.py:915
In definition 1:
    ValueError: Invalid value given for 'side': unicode_type
    raised from /home/pavlin/miniconda3/envs/tmp/lib/python3.7/site-packages/numba/targets/arraymath.py:3029
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 0x7fbd99cb17b8>)
[2] During: typing of call at /home/pavlin/dev/pynndescent/pynndescent/threaded.py (67)


File "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"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
slinnarssoncommented, Oct 14, 2019

In case it helps anyone, I had the same issue on a brand new install of Anaconda (version 2019.07 for macOS), which has numba version 0.44.1. Doing conda update numba gave me numba version 0.45.1, which resolved the issue.

0reactions
pavlin-policarcommented, Sep 3, 2019

After a bit more hunting, I found the issue is not specific to pynndescent, but to numba in general, and it only occurs in a conda environment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NumPy 1.17.0 Release Notes
New extensible numpy.random module with selectable random number generators# · PCG64 is the new default while · MT19937 is retained for backwards compatibility....
Read more >
Solved: numpy incompatibility - Intel Communities
Solved: I've managed to end up with an incompatible environment. I'm guessing that some package is missing some restriction on the version of...
Read more >
Pandas incompatible with numpy - Stack Overflow
In conda list, my numpy version is 1.19.1. I checked the above directory to find that it has only numpy 1.15.3 inside and...
Read more >
this version of pandas is incompatible with numpy < 1.17.3
ImportError: this version of pandas is incompatible with numpy < 1.17.3. your numpy version is 1.16.5. Please upgrade numpy to >= 1.17.3 to ......
Read more >
TensorFlow and Numpy Issue M1 | Apple Developer Forums
2 which is incompatible." shows. I can only install numpy 1.21.2 through pip. —. Yookey. 1 year ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found