pythonpackageanacondacondalevenshtein-distance

Difference between "levenshtein" and "python levenshtein" packages?


I installed the levenshtein module from conda-forge. I don't recall the exact command used, but it was likely something similar to conda install -c conda-forge PackageName. I queried the package versions. I see two packages with exactly the same version number:

(py39) C:\>conda list levenshtein$
# packages in environment at C:\Users\User.Name\AppData\Local\anaconda3\envs\py39:
#
# Name             Version          Build Channel
levenshtein        0.25.1  py39h99910a6_0 conda-forge
python-levenshtein 0.25.1    pyhd8ed1ab_0 conda-forge

The version matches what I could find online here and here. I can also find both variations on GitHube, here, here, and here.

To try and get an idea of whether they are different, I used Cygwin's Bash to navigate to Conda environment folder /c/Users/User.Name/AppData/Local/anaconda3/envs/py39 and searched for files related to the packages:

$ find * -name '*levenshtein*' -print | xargs ls -l
  7270 Jun  7 17:13 conda-meta/levenshtein-0.25.1-py39h99910a6_0.json
  4564 Jun  7 17:13 conda-meta/python-levenshtein-0.25.1-pyhd8ed1ab_0.json
  3951 Jan 27  2023 Lib/site-packages/gensim/similarities/__pycache__/levenshtein.cpython-39.pyc
  4505 Jan 27  2023 Lib/site-packages/gensim/similarities/levenshtein.py
219136 Apr  7 12:12 Lib/site-packages/Levenshtein/levenshtein_cpp.cp39-win_amd64.pyd

I'm not sure how to interpret these findings. Looking at the top 2 JSON files, I see possibly relevant selected lines

levenshtein-0.25.1-py39h99910a6_0.json
--------------------------------------
"extracted_package_dir": "C:\\Users\\User.Name\\AppData\\Local\\anaconda3\\pkgs\\levenshtein-0.25.1-py39h99910a6_0",
"fn": "levenshtein-0.25.1-py39h99910a6_0.conda",
  "source": "C:\\Users\\User.Name\\AppData\\Local\\anaconda3\\pkgs\\levenshtein-0.25.1-py39h99910a6_0",
"package_tarball_full_path": "C:\\Users\\User.Name\\AppData\\Local\\anaconda3\\pkgs\\levenshtein-0.25.1-py39h99910a6_0.conda",

python-levenshtein-0.25.1-pyhd8ed1ab_0.json
-------------------------------------------
"extracted_package_dir": "C:\\Users\\User.Name\\AppData\\Local\\anaconda3\\pkgs\\python-levenshtein-0.25.1-pyhd8ed1ab_0",
"fn": "python-levenshtein-0.25.1-pyhd8ed1ab_0.conda",
  "source": "C:\\Users\\User.Name\\AppData\\Local\\anaconda3\\pkgs\\python-levenshtein-0.25.1-pyhd8ed1ab_0",
"package_tarball_full_path": "C:\\Users\\User.Name\\AppData\\Local\\anaconda3\\pkgs\\python-levenshtein-0.25.1-pyhd8ed1ab_0.conda",

Are the two packages in fact the same? If so, why would they manifest as differently name packages? How can one check whether a common package is made available via two different names?


Solution

  • Looking through the package indices for python-levenshtein leads us to https://github.com/rapidfuzz/python-Levenshtein, which says in the README:

    ⚠️ The package was renamed to Levenshtein and can be found here. The python-Levenshtein package will continue to be updated alongside the new package

    So as it seems, they're the same package, with python-levenshtein being maintained for compatibility's sake.