Python – Unable to install python-Levenshtein on Windows, error code 1

Unable to install python-Levenshtein on Windows, error code 1… here is a solution to the problem.

Unable to install python-Levenshtein on Windows, error code 1

I

got this error when trying to install python-Levenshtein for the project I’m working on, and all the information I’m trying to find about it seems to be for other issues involving visuals that I haven’t encountered with studios and other resources that I haven’t installed or used for the project.

Any help would be appreciated. Thank you.

    Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\user1>pip install python-Levenshtein
Collecting python-Levenshtein
  Using cached https://files.pythonhosted.org/packages/42/a9/d1785c85ebf9b7dfacd
08938dd028209c34a0ea3b1bcdb895208bd40a67d/python-Levenshtein-0.12.0.tar.gz
Requirement already satisfied: setuptools in c:\users\user1\appdata\local\program
s\python\python37-32\lib\site-packages (from python-Levenshtein) (39.0.1)
Installing collected packages: python-Levenshtein
  Running setup.py install for python-Levenshtein ... error
    Complete output from command c:\users\user1\appdata\local\programs\python\pyt
hon37-32\python.exe -u -c "import setuptools, tokenize; __file__='C:\\Users\\user1
\\AppData\\Local\\Temp\\pip-install-fgsrabne\\python-Levenshtein\\setup.py'; f=ge
tattr(tokenize, 'open', open)(__file__); code=f.read().replace('\r\n', '\n'); f.cl
ose(); exec(compile(code, __file__, 'exec'))" install --record C:\Users\user1\AppD
ata\Local\Temp\pip-record-20u1vm40\install-record.txt --single-version-externall
y-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    creating build\lib.win32-3.7\Levenshtein
    copying Levenshtein\StringMatcher.py -> build\lib.win32-3.7\Levenshtein
    copying Levenshtein\__init__.py -> build\lib.win32-3.7\Levenshtein
    running egg_info
    writing python_Levenshtein.egg-info\PKG-INFO
    writing dependency_links to python_Levenshtein.egg-info\dependency_links.txt

writing entry points to python_Levenshtein.egg-info\entry_points.txt
    writing namespace_packages to python_Levenshtein.egg-info\namespace_packages
..txt
    writing requirements to python_Levenshtein.egg-info\requires.txt
    writing top-level names to python_Levenshtein.egg-info\top_level.txt
    reading manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*pyc' found anywhere in dist
ribution
    warning: no previously-included files matching '*so' found anywhere in distr
ibution
    warning: no previously-included files matching '.project' found anywhere in
distribution
    warning: no previously-included files matching '.pydevproject' found anywher
e in distribution
    writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
    copying Levenshtein\_levenshtein.c -> build\lib.win32-3.7\Levenshtein
    copying Levenshtein\_levenshtein.h -> build\lib.win32-3.7\Levenshtein
    running build_ext
    building 'Levenshtein._levenshtein' extension
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    creating build\temp.win32-3.7\Release\Levenshtein
    cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\users\user1\appdata\local\pro
grams\python\python37-32\include -Ic:\users\user1\appdata\local\programs\python\p
ython37-32\include "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.
0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-I
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program
 Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86
)\Windows Kits\NETFXSDK\4.6.1\include\um" /TcLevenshtein/_levenshtein.c /Fobuild
\temp.win32-3.7\Release\Levenshtein/_levenshtein.obj
    error: command 'cl.exe' failed: No such file or directory

----------------------------------------
Command "c:\users\user1\appdata\local\programs\python\python37-32\python.exe -u -
c "import setuptools, tokenize; __file__='C:\\Users\\user1\\AppData\\Local\\Temp\\
pip-install-fgsrabne\\python-Levenshtein\\setup.py'; f=getattr(tokenize, 'open',
open)(__file__); code=f.read().replace('\r\n', '\n'); f.close(); exec(compile(code,
 __file__, 'exec'))" install --record C:\Users\user1\AppData\Local\Temp\pip-recor
d-20u1vm40\install-record.txt --single-version-externally-managed --compile" fai
led with error code 1 in C:\Users\user1\AppData\Local\Temp\pip-install-fgsrabne\p
ython-Levenshtein\

Solution

Maybe installing for anaconda would help:

pip install conda
conda install -c conda-forge python-levenshtein 

Related Problems and Solutions