简体   繁体   English

将 fbprophet 作为 AWS Lambda 层导入

[英]Importing fbprophet as a AWS Lambda layer

Unable to package fbprophet into a layer that can be imported in to AWS Lambda.无法 package fbprophet 到可以导入到 AWS Lambda 的层中。 Need help with it.需要帮助。

My local computer is a Mac with Sierra installed.我的本地计算机是安装了 Sierra 的 Mac。 I am trying to create layers for different libraries that get used in Python 3 as part of the AWS Lambda serverless architecture.我正在尝试为在 Python 3 中使用的不同库创建层,作为 AWS Lambda 无服务器架构的一部分。 I have been successful packaging the Pandas library and imported it as a layer.我已经成功打包 Pandas 库并将其作为层导入。 But, when I try a similar approach for fbprophet, it is failing.但是,当我为 fbprophet 尝试类似的方法时,它失败了。

Error:错误:

ModuleNotFoundError: No module named 'pystan'

I am using a script that reads from a requirements file and installs the different modules listed in there.我正在使用从需求文件中读取并安装其中列出的不同模块的脚本。 Here is the code for the script:这是脚本的代码:

#!/bin/bash

export PKG_DIR="python"

docker run --rm -v $(pwd):/foo -w /foo lambci/lambda:build-python3.6 \
pip install -r requirements.txt -t ${PKG_DIR}

The requirements.txt file looks as follows: fbprophet==0.5 requirements.txt 文件如下所示:fbprophet==0.5

However, when I try fbprophet installation, it fails saying:但是,当我尝试安装 fbprophet 时,它失败了:

ModuleNotFoundError: No module named 'pystan'

I was expecting that fbprophet would be installed, which could be zipped and used as a layer on Lambda, but unable to proceed beyond the current point.我期待安装 fbprophet,它可以被压缩并用作 Lambda 上的一个层,但无法超越当前点。 Help in resolving this would be much appreciated.帮助解决这个问题将不胜感激。 Thank you.谢谢你。

Figured out that it was due to gcc compiler being not compatible that the fbprophet was not getting compiled and getting packaged into a AWS Lambda layer.发现这是由于 gcc 编译器不兼容导致 fbprophet 没有被编译并被打包到 AWS Lambda 层。 Created a virtual environment and installed gcc using conda, as follows:创建虚拟环境,使用conda安装gcc,如下:

conda install clang_osx-64 clangxx_osx-64 -c anaconda

Then, followed the steps in this article: https://towardsdatascience.com/how-to-get-fbprophet-work-on-aws-lambda-c3a33a081aaf然后,按照本文中的步骤操作: https://towardsdatascience.com/how-to-get-fbprophet-work-on-aws-lambda-c3a33a081aaf

This got fbprophet installed and I was able to package it and upload as a Lambda layer.这安装了 fbprophet,我能够对其进行 package 并作为 Lambda 层上传。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM