简体   繁体   English

OpenCV - AWS Lambda - /lib64/libz.so.1:未找到版本“ZLIB_1.2.9”

[英]OpenCV - AWS Lambda - /lib64/libz.so.1: version `ZLIB_1.2.9' not found

In Python, trying to run the opencv package in an AWS lambda layer.在 Python 中,尝试在 AWS lambda 层中运行 opencv package。 Using opencv-python-headless but keep getting this error.使用 opencv-python-headless 但不断收到此错误。

Response
{
  "errorMessage": "Unable to import module 'lambda_function': /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/python/lib/python3.8/site-packages/cv2/../opencv_python_headless.libs/libpng16-186fce2e.so.16.37.0)",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []
}

Have tried different versions of opencv to no avail.试过不同版本的opencv都没有用。 And different versions of python.和不同版本的 python。

You can create layer or just (if making layer isn't all mandatory) -您可以创建图层或只是(如果制作图层不是全部强制性的) -

  • install the necessary libraries in the same directory your lambda code in using pip install opencv-contrib-python -t.在使用pip install opencv-contrib-python -t. (. Means current directory, change if needed). (。表示当前目录,如果需要更改)。

  • After downloading all libraries zip them (along with the lambda) and store on a s3 bucket .下载所有库 zip 之后(连同 lambda)并存储在s3 bucket上。 Then just source lambda from that zip file and you should be good to go.然后只需从该 zip 文件中获取 lambda,您就可以使用 go。

Best wishes.最良好的祝愿。

I experienced the same issue as you.我遇到了和你一样的问题。 This issue occurred only after the latest update of openCV (4.7.0.68).此问题仅在 openCV (4.7.0.68) 的最新更新后出现。 Going back to the previous version 4.6.0.66 fixed the problem for me:回到以前的版本 4.6.0.66 为我解决了这个问题:

pip install opencv-python-headless==4.6.0.66

This is a known problem with the new update.这是新更新的已知问题。 See this github issue for more info: https://github.com/opencv/opencv-python/issues/772有关更多信息,请参阅此 github 问题: https://github.com/opencv/opencv-python/issues/772

In your requirements.txt file you probably didn't specify a specific version for opencv-python-headless - Thus each time you deploy a new image it installs the newest one.在您的requirements.txt文件中,您可能没有为opencv-python-headless指定特定版本 - 因此每次部署新图像时,它都会安装最新的图像。 And... guess what... the newest release was 2 weeks ago - and it appears not to be compatible with your environment.而且...猜猜看...最新版本是 2 周前发布的 - 它似乎与您的环境不兼容。 So:所以:

  1. Always specify the specific version you are using. Always指定您正在使用的特定版本。
  2. Specify version 4.6.0.66, as @job-heersink suggested.按照@job-heersink 的建议,指定版本 4.6.0.66。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法导入模块“lambda_function”:/lib64/libc.so.6:找不到版本“GLIBC_2.18” - Unable to import module 'lambda_function': /lib64/libc.so.6: version `GLIBC_2.18' not found /lib64/libm.so.6:找不到版本“GLIBC_2.27”(节点需要) - /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node) /lib64/libc.so.6:找不到版本“GLIBC_2.32” - /lib64/libc.so.6: version `GLIBC_2.32' not found /lib64/libm.so.6:未找到版本“GLIBC_2.27”- 将最新的 gatsby 应用程序部署到 Amazon Amplify 时出错 - /lib64/libm.so.6: version `GLIBC_2.27' not found - Error deploying latest gatsby app to Amazon Amplify AWS Lambda Opencv(“无法导入模块‘lambda_function’:libgthread-2.0.so.0:无法打开共享对象文件:没有这样的文件或目录”) - AWS Lambda Opencv ("Unable to import module 'lambda_function': libgthread-2.0.so.0: cannot open shared object file: No such file or directory") AWS Lambda; 修改版本或别名? - AWS Lambda; Modifications to the version or the alias? AWS Typescript CDK: Lambda 版本内部故障 - AWS Typescript CDK: Lambda Version Internal Failure AWS Lambda 层无法导入模块“lambda_function”:没有名为“pyarrow.lib”的模块 - AWS Lambda Layer Unable to import module 'lambda_function': No module named 'pyarrow.lib' AWS Lambda GraphicsMagick 错误:找不到 gm/convert 二进制文件” - AWS Lambda GraphicsMagick error: gm/convert binaries can't be found" apk-get 错误 -- 在 aws lambda 图像上找不到命令 - apk-get error-- command not found on aws lambda image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM