MaartenGr / PolyFuzz

Fuzzy string matching, grouping, and evaluation.

Home Page:https://maartengr.github.io/PolyFuzz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while trying the basic example

EtienneT opened this issue · comments

Installed using pip. Tried the very simple example from the readme, but got this error when importing the package.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-95b951ea2a53> in <module>
----> 1 from polyfuzz import PolyFuzz
      2 
      3 from_list = ["apple", "apples", "appl", "recal", "house", "similarity"]
      4 to_list = ["apple", "apples", "mouse"]
      5 

~\miniconda3\envs\fastai\lib\site-packages\polyfuzz\__init__.py in <module>
----> 1 from .polyfuzz import PolyFuzz
      2 __version__ = "0.3.0"

~\miniconda3\envs\fastai\lib\site-packages\polyfuzz\polyfuzz.py in <module>
      5 from polyfuzz.linkage import single_linkage
      6 from polyfuzz.utils import check_matches, check_grouped, create_logger
----> 7 from polyfuzz.models import TFIDF, RapidFuzz, Embeddings, BaseMatcher
      8 from polyfuzz.metrics import precision_recall_curve, visualize_precision_recall
      9 

~\miniconda3\envs\fastai\lib\site-packages\polyfuzz\models\__init__.py in <module>
      2 from ._distance import EditDistance
      3 from ._rapidfuzz import RapidFuzz
----> 4 from ._tfidf import TFIDF
      5 from ._utils import cosine_similarity
      6 

~\miniconda3\envs\fastai\lib\site-packages\polyfuzz\models\_tfidf.py in <module>
      5 from sklearn.feature_extraction.text import TfidfVectorizer
      6 
----> 7 from ._utils import cosine_similarity
      8 from ._base import BaseMatcher
      9 

~\miniconda3\envs\fastai\lib\site-packages\polyfuzz\models\_utils.py in <module>
      7 
      8 try:
----> 9     from sparse_dot_topn import awesome_cossim_topn
     10     _HAVE_SPARSE_DOT = True
     11 except ImportError:

~\miniconda3\envs\fastai\lib\site-packages\sparse_dot_topn\__init__.py in <module>
      3 
      4 if sys.version_info[0] >= 3:
----> 5     from sparse_dot_topn.awesome_cossim_topn import awesome_cossim_topn
      6 else:
      7     from awesome_cossim_topn import awesome_cossim_topn

~\miniconda3\envs\fastai\lib\site-packages\sparse_dot_topn\awesome_cossim_topn.py in <module>
      5 
      6 if sys.version_info[0] >= 3:
----> 7     from sparse_dot_topn import sparse_dot_topn as ct
      8     from sparse_dot_topn import sparse_dot_topn_threaded as ct_thread
      9 else:

__init__.pxd in init sparse_dot_topn.sparse_dot_topn()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Did you use pip install polyfuzz or pip install polyfuzz[fast] ?

@rudrashisgorai I did the following sequence. One thing to note, I am on Windows. Not sure if it change anything:

conda install -c conda-forge sparse_dot_topn
pip install polyfuzz
pip install polyfuzz[all]

Did the exact same setup in WSL 2 in Ubuntu, got the exact same error.

Which version of numpy do you have? I have noticed some issues with that. Could you try it out with numpy v1.20 or higher?

Installed numpy 1.20.3, and running the basic example works now.

But I get the following errors when using pip:

polyfuzz 0.3.2 requires numpy<=1.19.4,>=1.18.5, but you have numpy 1.20.3 which is incompatible.

Numpy was upgraded to the new version to be compatible with the package. If in a new environment, you try out the new version of PolyFuzz, you should have no issues.

If it does not work out, please let me know!