I've been dealing with this issue for the past few days now. I am trying to create a lambda layer with the following modules: cryptography, ldap3, and bonsai to use in my lambda_function that has a runtime of python3.11 and architecture type of x86_64. I have been using AWS CloudShell to create the lambda_layer zip file.
This is how I installed cryptography and ldap3:
-pip3.11 install \
--platform manylinux2014_x86_64 \
--target=my-lambda-function \
--implementation cp \
--python-version 3.11.8 \
--only-binary=:all: --upgrade \
cryptography
-pip3.11 install \
--platform manylinux2014_x86_64 \
--target=my-lambda-function \
--implementation cp \
--python-version 3.11.8 \
--only-binary=:all: --upgrade \
ldap3
These two modules work just fine I can call the module in my lambda function, the issue is with the bonsai module. Unfortunately, I can't install the bonsai module like this:
pip3.11 install \
--platform manylinux2014_x86_64 \
--target=my-lambda-function \
--implementation cp \
--python-version 3.11.8 \
--only-binary=:all: --upgrade \
bonsai
Because I get the following error when I run this command:
ERROR: Could not find a version that satisfies the requirement bonsai (from versions:none)
ERROR: No matching distribution found for bonsai
Therefore this is how I am installing bonsai:
pip3.11 install bonsai --target=my-lambda-function
But when I try to call the bonsai module in my lambda function I get this error:
Unable to import module 'lambda function': libldap_r-2.4.so.2 cannot open shared objectfile: No such file or directory
Does anybody know how to resolve this issue, I've completely hit a brick wall. Any help is welcome!