python-Levenshtein icon indicating copy to clipboard operation
python-Levenshtein copied to clipboard

Install fails when using Python 3.9

Open woctezuma opened this issue 3 years ago • 15 comments

(venv) C:\Users\Wok\pypi\steampi>pip install python-Levenshtein
Collecting python-Levenshtein
  Using cached python-Levenshtein-0.12.0.tar.gz (48 kB)
Requirement already satisfied: setuptools in c:\users\wok\pypi\steampi\venv\lib\site-packages (from python-Levenshtein) (50.3.2)
Using legacy 'setup.py install' for python-Levenshtein, since package 'wheel' is not installed.
Installing collected packages: python-Levenshtein
    Running setup.py install for python-Levenshtein ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\wok\pypi\steampi\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Wok\\AppData\\Local\\Temp\\pip-install-0tpeo10x\\python-levenshtein\\setup.py'"'"'; __file__='"'"'
C:\\Users\\Wok\\AppData\\Local\\Temp\\pip-install-0tpeo10x\\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\Wok\AppData\Local\Temp\pip-record-hpvrgp_8\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\wok\pypi\steampi\venv\include\site\python3.9\python
-Levenshtein'
         cwd: C:\Users\Wok\AppData\Local\Temp\pip-install-0tpeo10x\python-levenshtein\
    Complete output (27 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\Levenshtein
    copying Levenshtein\StringMatcher.py -> build\lib.win-amd64-3.9\Levenshtein
    copying Levenshtein\__init__.py -> build\lib.win-amd64-3.9\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 distribution
    warning: no previously-included files matching '*so' found anywhere in distribution
    warning: no previously-included files matching '.project' found anywhere in distribution
    warning: no previously-included files matching '.pydevproject' found anywhere in distribution
    writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
    copying Levenshtein\_levenshtein.c -> build\lib.win-amd64-3.9\Levenshtein
    copying Levenshtein\_levenshtein.h -> build\lib.win-amd64-3.9\Levenshtein
    running build_ext
    building 'Levenshtein._levenshtein' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\wok\pypi\steampi\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Wok\\AppData\\Local\\Temp\\pip-install-0tpeo10x\\python-levenshte
in\\setup.py'"'"'; __file__='"'"'C:\\Users\\Wok\\AppData\\Local\\Temp\\pip-install-0tpeo10x\\python-levenshtein\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.cl
ose();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Wok\AppData\Local\Temp\pip-record-hpvrgp_8\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\wok\pypi\steampi\v
env\include\site\python3.9\python-Levenshtein' Check the logs for full command output.

woctezuma avatar Oct 28 '20 16:10 woctezuma

Related: #42, #44, #45, #46, https://github.com/seatgeek/fuzzywuzzy/issues/235

woctezuma avatar Oct 28 '20 16:10 woctezuma

I haven't had a chance to test it on Windows or OSX yet, but I created wheels and put the package on pypi as levenshtein. Could you let me know if this works for you?

pip install levenshtein

polm avatar Jan 11 '21 07:01 polm

I cannot test it for now. If I remember right, the problem was solved by following the recommendation in the error message:

Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

woctezuma avatar Jan 11 '21 08:01 woctezuma

Installing the Microsoft C++ Build Tools is always what works for me. It may be helpful to include this on the ReadMe instructions

jaimiles23 avatar Jan 24 '21 02:01 jaimiles23

On a Linux system you'll need Python dev tools, sudo dnf install python3-devel.

alsaydi avatar Mar 19 '21 02:03 alsaydi

On Ubuntu sudo apt-get install python3.9-dev fixed this for me.

MisterBiggs avatar Mar 27 '21 22:03 MisterBiggs

On Ubuntu sudo apt-get install python3.9-dev fixed this for me.

This actually works with every version e.g. sudo apt install python3.X-dev --> sudo apt install python3.8-dev

lstappen avatar Apr 21 '21 13:04 lstappen

Sure I've misunderstood something but

pip install levenshtein
sudo apt install python3.X-dev
pip install python-Levenshtein

Is leaving me with the same legacy-install-error.

SolebaySharp avatar Feb 28 '22 14:02 SolebaySharp

@SolebaySharp why do you try to install both Levenshtein and python-Levenshtein? It would be enough to install Levenshtein, which probably provides a wheel for your platform.

maxbachmann avatar Feb 28 '22 15:02 maxbachmann

@maxbachmann Just to show I'd tried both approaches really.

SolebaySharp avatar Feb 28 '22 18:02 SolebaySharp

@SolebaySharp did both approaches fail?

maxbachmann avatar Feb 28 '22 18:02 maxbachmann

@maxbachmann yes unfortunately.

pip install python-Levenshtein fails to install (legacy-install-error) and pip install levenshtein works but when I run from fuzzywuzzy import fuzz I still get the error message:

UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')

Unless it's just a case that packages can't use either/or because the name differs.


To be explicit:

python3.6 -m venv p3.6
source p3.6/bin/activate
pip install python-Levenshtein

Works. But...

python3.6 -m venv p3.6
source p3.6/bin/activate
pip install python-Levenshtein

Returns....

    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/solebay/p3.8/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k3gyeuus/python-levenshtein_b481a0d762974c65b15083869f89ea05/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k3gyeuus/python-levenshtein_b481a0d762974c65b15083869f89ea05/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-fzop1uiz/install-record.txt --single-version-externally-managed --compile --install-headers /home/solebay/p3.8/include/site/python3.8/python-Levenshtein Check the logs for full command output.


Edit: This is my fault @maxbachmann. A fresh environment (not an old one with modules deleted) , plus updated pip (and wheel enabled) meant that pip install leveshtein works with 3.8.

SolebaySharp avatar Mar 02 '22 17:03 SolebaySharp

does anyone can help me? i use Windows.

got error like @woctezuma ...

Running setup.py install for python-Levenshtein ... error error: subprocess-exited-with-error

× Running setup.py install for python-Levenshtein did not run successfully. │ exit code: 1 ╰─> [27 lines of output] running install running build running build_py creating build creating build\lib.win-amd64-3.8 creating build\lib.win-amd64-3.8\Levenshtein copying Levenshtein\StringMatcher.py -> build\lib.win-amd64-3.8\Levenshtein copying Levenshtein_init_.py -> build\lib.win-amd64-3.8\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 distribution
warning: no previously-included files matching '*so' found anywhere in distribution
warning: no previously-included files matching '.project' found anywhere in distribution warning: no previously-included files matching '.pydevproject' found anywhere in distribution writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt' copying Levenshtein_levenshtein.c -> build\lib.win-amd64-3.8\Levenshtein copying Levenshtein_levenshtein.h -> build\lib.win-amd64-3.8\Levenshtein running build_ext building 'Levenshtein._levenshtein' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> python-Levenshtein

note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

sitiharyanti avatar Mar 26 '22 04:03 sitiharyanti

does anyone can help me? i use Windows.

https://github.com/ztane/python-Levenshtein/issues/58#issuecomment-757693558

woctezuma avatar Mar 26 '22 07:03 woctezuma

TQ @woctezuma . GiulioRossetti already answer me in #189 https://github.com/GiulioRossetti/cdlib/issues/189

i try to to install MS Visual C++ >= 14 properly. Hopefully it works.

sitiharyanti avatar Mar 26 '22 08:03 sitiharyanti