Skip to content

Solution for AWS lambda ModuleNotFoundError: No module named *

License

Notifications You must be signed in to change notification settings

sedrakpc/pycares-lambda-layers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pycares-lambda-layers

Solution for aws lambda ModuleNotFoundError: No module named * for example 'pycares._cares'

To rebuild the layer use the command below(docker required) ↓

docker run -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.8" /bin/sh -c "pip install -r requirements.txt -t python/lib/python3.8/site-packages/; exit"
zip -r sd-scan-lib-layer.zip python > /dev/null

Change python3.8 to your lambda enviroment python version you can find all aws lambda enviroment docker images here This example is for pycares only, but you can change requirements.txt and rebuild the later for any python library or separate all the dependencies into one layer.

Some useful links ↓

How do I create a Lambda layer

Deploy Python Lambda functions

Image repository URIs

About

Solution for AWS lambda ModuleNotFoundError: No module named *

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages