Search code examples
pythonimportpackagelevenshtein-distance

Cannot get python packages to work


I am trying to calculate levenshtein distance between 2 strings. Tried to install 2 packages (python-levenshtein) and pylev

Used ananconda (on Win 64 machine) for the install

conda install -c https://conda.anaconda.org/trent pylevenshtein

It looks like the package got installed

Fetching package metadata: ......
Solving package specifications: ..............
Package plan for installation in environment C:\Anaconda2:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
pylevenshtein-0.10.1       |           py27_0          34 KB
setuptools-20.1.1          |           py27_0         674 KB
------------------------------------------------------------
                                       Total:         707 KB

The following NEW packages will be INSTALLED:

pylevenshtein: 0.10.1-py27_0

The following packages will be UPDATED:

setuptools:    19.6.2-py27_0 --> 20.1.1-py27_0

Proceed ([y]/n)? y

Fetching packages ...
pylevenshtein- 100% |###############################| Time: 0:00:0042.36    kB/s
setuptools-20. 100% |###############################| Time: 0:00:02 320.43 kB/s
 Extracting packages ...
[      COMPLETE      ]|##################################################| 100%
Unlinking packages ...
[      COMPLETE      ]|##################################################| 100%
Linking packages ...
[      COMPLETE      ]|##################################################| 100%

However , when I try to import the package it says no module name pylev . Same thing happens with Python-levenshtein . Command used are (tried variants of his but doesn't seem to work)

import pylev
import Levenshtein

Unable to figure out what the problem is


Solution

  • Some modules (this is a C extension) must be compiled for the architecture you are using. See explained for your case here.

    But you can always use compiled versions if they are available (as is the case for pylevenshtein) from Christoph Gohlke's website