Aws lambda returns /lib64/libc.so.6: version `GLIBC_2.28' not found
Asked Answered
A

3

7

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.

Antonomasia answered 16/2, 2023 at 12:31 Comment(4)
Can you install a much newer version of cryptography like 38 for example and see if you still get the error?Bloodline
@Bloodline not working, installed last version and same error.Antonomasia
It looks to be related to this?Bloodline
@Bloodline tested and not working. Still the same error.Antonomasia
U
6
  1. Always try to build a lambda layer in a Linux environment.
  2. Use the following pip syntax to build packages.
pip install --upgrade <pakage names> --platform manylinux2014_x86_64 --only-binary=:all: -t .
Urumchi answered 28/3 at 22:4 Comment(1)
Thank you so much. Installing packages this way worked for me.Ninos
A
5

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.

Antonomasia answered 17/2, 2023 at 11:30 Comment(0)
V
4

I recently encountered the exact same issue, and I managed to resolve it using a technique similar to what was suggested by @mrc back in 2017. To rectify the situation, I added the snowflake-connector-python==2.7.9 library into a dummy virtual environment, which is then utilized to generate my Lambda layer zip folder. I accomplished this by running the following command::

pip3 install \
--platform manylinux2010_x86_64 \
--implementation cp \
--only-binary=:all: --upgrade \
--target venv/lib/python3.10/site-packages/ \
 snowflake-connector-python==2.7.9 boto3>=1.26.153 botocore>=1.29.153

It's essential to include both boto3 and botocore libraries, and also, it's crucial to use python3.10, as elucidated in this comment: link.

Vasti answered 16/8, 2023 at 5:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.