Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 579
mrc Avatar asked Apr 19 '26 18:04

mrc


2 Answers

  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 .
like image 75
Ehsan Avatar answered Apr 22 '26 22:04

Ehsan


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.

like image 27
mrc Avatar answered Apr 22 '26 22:04

mrc