在AWS Lambda Python函数上进行Shapely设置 [英] Setting up Shapely on AWS Lambda Python functions
问题描述
我尝试在AWS Lambda
上设置Shapely,但始终收到以下错误.
I have a tried to setup Shapely on AWS Lambda
but was getting the below error always.
module initialization error: Could not find lib geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so', '/usr/lib/libgeos_c.so'].
在这种情况下,不确定如何构建shapely
.在Linux
实例上构建了我的程序包,并将其用于部署目的.
Not sure how to build shapely
in this case. Have built my package on Linux
instance and have used the same for deployment purpose.
推荐答案
如果您希望构建自己的与Lambda兼容的二进制文件以供您的Deployment软件包使用,则AWS声明在此处构建它们所需的AMI:
If you wish to build your own Lambda compatible binaries for use in your Deployment packages, AWS states the AMI needed to build them here:
https://docs.aws.amazon .com/lambda/latest/dg/current-supported-versions.html
我已经使用该特定的AMI创建了EC2实例,然后使用pip将所需的软件包安装到目标文件夹-t
中.完成后,我只需将其打包,然后将其用作我的部署程序包的基础即可.
I have created an EC2 instance with that specific AMI and then used pip to install the packages I needed into a target folder -t
. Once complete I simply tar'd that up and used it as the basis for my deployment package and it worked.
或者我从以下网址下载: https://github.com/ryfeus/lambda-packs一个> 并复制了我需要的软件包. (在shapley的情况下,是shapely和shapely-1.6b4.dist-info目录.
Alternatively I have downloaded from : https://github.com/ryfeus/lambda-packs and copied the packages I have needed. (Which in the case of shapley, was the shapely and shapely-1.6b4.dist-info directories.
我相信这些文件目前仅针对Python 2.7构建,并且我仅使用上述AMI为Python 2.7编译了二进制文件.
I believe these are only built for Python 2.7 at the moment, and I have only compiled binaries with the above AMI for Python 2.7.
HTH
这篇关于在AWS Lambda Python函数上进行Shapely设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!