I am running an AWS Lambda function that uses one layer with snowflake-connector-python.
To create the layer I use:
docker run -v <your dev directory>:/lambda -it --rm ubuntu
apt-get update
apt-get install python3-pip
apt-get install zip
cd lambda
mkdir -p temp/python
cd temp/python
pip3 install snowflake-connector-python -t .
cd ..
zip -r9 ../snowflake-connector-python.zip .
The lambda returns:
"errorMessage": "Unable to import module 's3PutLambda': /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /opt/python/cryptography/hazmat/bindings/_rust.abi3.so)",
"errorType": "Runtime.ImportModuleError",
"requestId": "baa60d07-c9bb-4b32-a38f-3158eb50da09",
"stackTrace": []
I tried also some other solutions, such as adding to the zip:
pip3 install cryptography==3.4.8
pip3 install bcrypt==3.2.2
The same error was raised.
pip install --upgrade <pakage names> --platform manylinux2014_x86_64 --only-binary=:all: -t .
Finally solved, you need to downgrade snowflake-connector-python version and install it using platform manylinux2010_x86_64.
pip installs packages from latest wheel unless you specify wheels version. The Python library packages I used were newer than the ones in runtime in Lambda backend containers.
If you specify manylinux2010 platform when installing the connector it fixes the issue.
The command I used is:
pip3 install --platform manylinux2010_x86_64 --implementation cp --python 3.8 --only-binary=:all:
--upgrade --target . snowflake-connector-python==2.7.9
Obs:
I have not tested it with higher snowflake-connector-python versions, neither with higher python versions. I use Python 3.8 runtime in AWS Lambda.
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