I'm trying to install the python-Levenshtein library on linux, but whenever I try to install it via:
sudo pip install python-Levenshtein
I get this error:
Command "/usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-LAmG4b/python-Levenshtein/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-KGiQPH-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-LAmG4b/python-Levenshtein
And the error code: error: command 'gcc' failed with exit status 1
I'm using debian linux.
One of the python-Levenshtein
maintainers here.
Make sure you have python-dev
and build-essential
packages.
Are you sure that's full error message as the actual error seem to be missing?
If a log file is created can you peek into it and add its content to the question.
Also read the official Python package installation guide. Use virtual environments. Never do sudo pip install
unless you have a specific reason to do so.
Just in case if anyone will encounter the same issue as the author of this question:
I faced the same issue on Ubuntu 20.04. I wanted to use a library which depends on python-Levenstein.
Mikkos answer above was correct. When installing, I have obtained further line in the end of exception:
'x86_64-linux-gnu-gcc' failed with exit status 1
which directly means a problem with building tool.
Then I found this answer by Paulie
Overall, in my case it was simply executing:
sudo apt-get install python3.7-dev
Then I installed the library using:
pip install python-Levenshtein
I hope this will be clear for everyone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With