saucy_b
saucy_b

Reputation: 21

Integration of python libraries in AWS Lambda

directory_picture

Hey everyone, I am a begginer programmer trying to make a web app with AWS, and I have been trying to make bs4 work, but it keeps coming up with the error:

{
  "errorMessage": "Unable to import module 'lambda_function': No module named 'bs4'",
  "errorType": "Runtime.ImportModuleError"
}

I have even installed the library locally in the same directory, and zipped it and uploaded it, but it still comes up this error?

Upvotes: 1

Views: 2108

Answers (1)

saucy_b
saucy_b

Reputation: 21

Hey so I got the solution!

I basically made a virtualenv and followed some steps to enable the libraries to work. Also note, the requests library doesn't seem to work due to a certificate error.

This is the page I used to fix my issue:

https://medium.com/@manivannan_data/import-custom-python-packages-on-aws-lambda-function-5fbac36b40f8

For any begginers like me, you can do this for any version of python per requirement, as I used python 3.8. This should also work for almost all python libraries!

Upvotes: 1

Related Questions