【发布时间】:2020-11-01 20:23:39
【问题描述】:
我使用 CRUD 操作创建了一个简单的 Flask Web 应用程序,并使用以下 requirements.txt 文件部署在 beanstalk 中
Flask==1.1.1
Flask-MySQLdb==0.2.0
Jinja2==2.11.1
mysql==0.0.2
mysqlclient==1.4.6
SQLAlchemy==1.3.15
Werkzeug==1.0.0
Flask-Cors==3.0.8
Flask-Mail==0.9.1
Flask-SocketIO==4.3.0
它工作得很好,然后我写了一个下面的函数
import tensorflow as tf
import keras
from keras.models import load_model
import cv2
import os
def face_shape_model():
classifier = load_model('face_shape_recog_model.h5')
image = cv2.imread('')
res = str(classifier.predict_classes(image, 1, verbose=0)[0])
return {"prediction": res}
将以下包包含在 request.txt 文件中
keras==2.3.1
tensorflow==1.14.0
opencv-python==4.2.0.32
整个烧瓶应用程序在我的本地环境中运行良好,因此我在部署后压缩并部署到 AWS elasticbeanstalk 中记录了以下错误
Unsuccessful command execution on instance id(s) 'i-0a2a8a4c5b3e56b81'. Aborting the operation.
Your requirements.txt is invalid. Snapshot your logs for details.
如上所述,我检查了我的日志,它显示以下错误
distutils.errors.CompileError: command 'gcc' failed with exit status 1
所以我搜索了上面的错误找到下面的解决方案,我创建了 yml 文件并将其添加到 .ebextension 文件中,如下所示
packages:
yum:
gcc-c++: []
但我仍然遇到同样的错误。我该如何解决这个问题或者上面是否有任何错误的步骤
谢谢。
【问题讨论】:
-
TensorFlow 不需要 GPU 或 CUDA 吗?
-
@Marcin 在我的本地环境设置中,它与上面的 requirments.txt 文件配合得很好
-
也许可以尝试不同的方法。您可以登录到您的 EB 实例,然后手动设置您的项目。这包括安装依赖项、编译 tensorflow 等。这种方式将能够验证它是否有效,并且问题仅限于自动化部署。
-
@Marcin 我尝试使用 docker 容器,现在它工作正常,谢谢
标签: python tensorflow flask keras amazon-elastic-beanstalk