Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails when using Python 3.9 #58

Open
woctezuma opened this issue Oct 28, 2020 · 15 comments
Open

Install fails when using Python 3.9 #58

woctezuma opened this issue Oct 28, 2020 · 15 comments

Comments

@woctezuma
Copy link

(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
Copy link
Author

woctezuma commented Oct 28, 2020

Related: #42, #44, #45, #46, seatgeek/fuzzywuzzy#235

@polm
Copy link

polm commented Jan 11, 2021

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

@woctezuma
Copy link
Author

woctezuma commented Jan 11, 2021

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/

@jaimiles23
Copy link

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

@alsaydi
Copy link

alsaydi commented Mar 19, 2021

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

@MisterBiggs
Copy link

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

@lstappen
Copy link

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

@SolebaySharp
Copy link

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.

@maxbachmann
Copy link

@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.

@SolebaySharp
Copy link

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

@maxbachmann
Copy link

@SolebaySharp did both approaches fail?

@SolebaySharp
Copy link

SolebaySharp commented Mar 2, 2022

@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.

@sitiharyanti
Copy link

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.

@woctezuma
Copy link
Author

does anyone can help me? i use Windows.

#58 (comment)

@sitiharyanti
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants