DeNederlandscheBank / name_matching

Other
128 stars 43 forks source link

bumpy and Numba conflict #4

Closed shalomma closed 10 months ago

shalomma commented 2 years ago

using the following versions: numba==0.55.1 numpy==1.21.6

with python Python 3.8.9

I get an error importing numba jit in the sparse_cosine.py file:

RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe Traceback (most recent call last): File "/Users/maayan.shalom/PycharmProjects/bbb/matching.py", line 3, in from name_matching.name_matcher import NameMatcher File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/name_matching/name_matcher.py", line 13, in from name_matching.sparse_cosine import sparse_cosine_top_n File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/name_matching/sparse_cosine.py", line 3, in from numba import jit File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/numba/init.py", line 38, in from numba.core.decorators import (cfunc, generated_jit, jit, njit, stencil, File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/numba/core/decorators.py", line 12, in from numba.stencils.stencil import stencil File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/numba/stencils/stencil.py", line 11, in from numba.core import types, typing, utils, ir, config, ir_utils, registry File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/numba/core/ir_utils.py", line 16, in from numba.core.extending import _Intrinsic File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/numba/core/extending.py", line 19, in from numba.core.pythonapi import box, unbox, reflect, NativeValue # noqa: F401 File "/Users/maayan.shalom/PycharmProjects/bbb/venv/lib/python3.8/site-packages/numba/core/pythonapi.py", line 12, in from numba import _helperlib ImportError: numpy.core.multiarray failed to import


When masking as follows, it works fine (no need for low memory): ` import numpy as np from tqdm import tqdm # from numba import jit from scipy.sparse import csc_matrix, coo_matrix from typing import Union

# @jit(nopython=True, fastmath=True) def _sparse_cosine_low_memory(matrix_row: np.array, ... `

mnijhuis-dnb commented 2 years ago

Thanks for flagging the issue, as numba can more often give problems it should be moved to an optional feature in a future release

mnijhuis-dnb commented 2 years ago

Commented out the numba code, should be made optional in the future