Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install python-Levenshtein on AWS (lambda) to speed up fuzzywuzzy

I am using fuzzywuzzy on Amazon Aws Lambda. I get the following error:

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

I don't have this problem on my local pc because I have: pip install python-Levenshtein

But how to do this on AWS Lambda?

I know python-Levenshtein uses C, and that seems to be the problem. Is there a way to do so? If so, can you provide step by step instructions?

I have added python-Levenshtein in my deployment package.

But it doesn't seem to prevent the warning.

like image 462
RookieCookie Avatar asked May 17 '26 03:05

RookieCookie


1 Answers

Indeed, AWS Lambda has issues deploying packages that are not pure Python but work with extension modules. You will have to make sure that your code is compiled for Linux. Perhaps the following guide can help you: https://markn.ca/2018/02/python-extension-modules-in-aws-lambda/

like image 173
E.T. Avatar answered May 18 '26 19:05

E.T.