Aws Lambda 返回 /lib64/libc.so.6: version `GLIBC_2.28' not found。

4

我正在运行一个使用带有的AWS Lambda函数

为了创建这个层,我使用:

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 .

这个 lambda 返回:

"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": []

我也尝试了其他的解决方案,比如将其添加到压缩包中:

pip3 install cryptography==3.4.8
pip3 install bcrypt==3.2.2

出现了相同的错误。


你能安装一个更新的加密库版本,比如38,看看是否仍然会出现错误吗? - Sergiu
@Sergiu 不起作用,安装了最新版本还是同样的错误。 - mrc
这似乎与这个有关? - Sergiu
@Sergiu测试过了,但是不起作用。错误还是一样的。 - mrc
2个回答

4

问题终于解决了,您需要降级snowflake-connector-python版本,并使用平台manylinux2010_x86_64进行安装。

pip会安装最新的wheel包,除非您指定wheel的版本。我使用的Python库包比Lambda后端容器中运行时使用的库包要新。

如果在安装连接器时指定manylinux2010平台,则可以解决此问题。

我使用的命令是:

pip3 install --platform manylinux2010_x86_64 --implementation cp --python 3.8 --only-binary=:all: 
--upgrade --target . snowflake-connector-python==2.7.9

注意: 我尚未测试过更高版本的snowflake-connector-python,也没有测试过更高版本的Python。我在AWS Lambda中使用Python 3.8运行时。


0
我最近遇到了完全相同的问题,并且我成功地使用了类似于@mrc在2017年提出的技术来解决它。为了纠正这种情况,我将snowflake-connector-python==2.7.9库添加到一个虚拟环境中,然后利用该环境生成我的Lambda层zip文件。我通过运行以下命令来实现这一点:
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

在这个评论中明确说明,包括 boto3botocore 库是必不可少的,而且使用 python3.10 是至关重要的。链接


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接