'Import of python-levenshtein/levenshtein failed after successfully pip install

after successfully pip install python-Levenshtein I can't import this lib. I tried several import commands, but I'll always get the same error message in VS Code Import "Levenshtein" could not be resolved, Pylance(reportMissingImports):

from Levenshtein import distance as lev
import Levenshtein as lev
import Levenshtein
import python_levenhstein 

If I list up my packages pip list, I get all my packages inside my venv:

Package            Version
------------------ -------
jarowinkler        1.0.2
Levenshtein        0.18.1
pip                22.0.4
python-Levenshtein 0.12.2
rapidfuzz          2.0.11
setuptools         60.10.0

I created a virtual env via terminal with python3 -m venv .venv and activate it by source .venv/bin/activate.

Also, when I go to my .venv I see this levenshtein package folder. It's my first time using VS Code, so it might be a settings failure, but I tried installing other packages into my venv, and I was able to import them.



Solution 1:[1]

I think the problem is thatLevenshtein uses C code. Try adding wheels for it --> https://pypi.org/project/python-Levenshtein-wheels/#files.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Orza