Levenshtein icon indicating copy to clipboard operation
Levenshtein copied to clipboard

ModuleNotFoundError: No module named 'Levenshtein.levenshtein_cpp'

Open Jeremy98-alt opened this issue 2 years ago • 7 comments

Good morning Everyone! I had this problem few minutes ago, why is there error?

PythonException: 
  An exception was thrown from the Python worker. Please see the stack trace below.
Traceback (most recent call last):
  File "<frozen zipimport>", line 262, in load_module
  File "C:\Users\Jeremy\AppData\Local\Temp\spark-bc9b7249-7b7c-45f4-bb98-bfb831cd02ea\userFiles-31251d1d-d5c1-43cc-9182-c4f18afaa741\Levenshtein.zip\Levenshtein\__init__.py", line 35, in <module>
    from Levenshtein.levenshtein_cpp import (
ModuleNotFoundError: No module named 'Levenshtein.levenshtein_cpp'

Jeremy98-alt avatar Aug 01 '22 08:08 Jeremy98-alt

How did you install the module?

maxbachmann avatar Aug 01 '22 10:08 maxbachmann

I installed it inside python (and it worked), but when I wanted to insert this as .zip inside pyspark path, this returns me this thing

Jeremy98-alt avatar Aug 01 '22 13:08 Jeremy98-alt

I assume you did not build the C extension first. In your case this can be done in place using

python setup.py build_ext --inplace

maxbachmann avatar Aug 01 '22 14:08 maxbachmann

I tried to import the package inside aws and i got the same issue :(

"ModuleNotFoundError: No module named 'Levenshtein.levenshtein_cpp"

Jeremy98-alt avatar Aug 02 '22 09:08 Jeremy98-alt

At least in case you installed using

pip install Levenshtein

This issue should not occur to the best of my knowledge.

maxbachmann avatar Aug 03 '22 14:08 maxbachmann

Yeah I did it, but I had that problem.. also importing the packages inside the cloud

Jeremy98-alt avatar Aug 04 '22 10:08 Jeremy98-alt

Did you check whether levenshtein_cpp exists in the directory. The installation should not succeed unless it created this file. So I am unsure how you ended up with this broken build.

maxbachmann avatar Aug 04 '22 11:08 maxbachmann

我最近也遇到了这个问题并解决了;问题的原因如下 1、Levenshtein库需要依赖rapidfuzz库,需要将rapidfuzz一起打包; 2、注释掉 Lib\site-packages\Levenshtein_init_.py文件里的 “from Levenshtein.levenshtein_cpp import ( quickmedian, median, median_improve, setmedian, setratio, seqratio, )” 这段代码

talige avatar Jun 10 '23 14:06 talige