繁体   English   中英

错误:在 AWS Beanstalk 上部署 web 应用程序时出现 ResolutionImpossible 错误

[英]ERROR: ResolutionImpossible error when deploying web application on AWS Beanstalk

更新:

2022.05.08 我将“requirement.txt”重命名为“requirements.txt”。 但它不能解决我的问题。 现在,新的错误信息是

2022/05/08 03:30:45.608563 [INFO] ERROR: Cannot install -r requirements.txt (line 1), -r requirements.txt (line 7) and botocore==1.23.24 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

这里有更多信息

健康事业:

ELB processes are not healthy on all instances.
None of the instances are sending data.
ELB health is failing or not available for all instances.

前 10 行(需求文件),该文件由命令“pip freeze > requirements.txt”创建

aiobotocore==2.1.1
aiohttp==3.8.1
aioitertools==0.10.0
aiosignal==1.2.0
async-timeout==4.0.2
attrs==21.4.0
boto3==1.21.10
botocore==1.23.24
certifi==2021.10.8
charset-normalizer==2.0.12

因此,无法安装的软件包是:“aiobotocore”、“botocore”和“boto3”。

看起来很连线。 “boto3”对于 AWS 来说是 Python SDK,为什么 AWS Elastic Beanstalk 不支持它?


我创建了一个 flask 应用程序来从 S3 下载文件。 它在我的本地 PC 上运行良好,但当我尝试在 AWS Elastic Beanstalk 上部署我的代码时遇到“健康:严重”问题。

我检查了日志并发现了这个:

May  8 01:28:48 ip-172-31-7-112 web: from flask import Flask, Response, render_template
May  8 01:28:48 ip-172-31-7-112 web: ModuleNotFoundError: No module named 'flask'
May  8 01:28:48 ip-172-31-7-112 web: [2022-05-08 01:28:48 +0000] [4977] [INFO] Worker exiting (pid: 4977)
May  8 01:28:48 ip-172-31-7-112 web: [2022-05-08 01:28:48 +0000] [4971] [INFO] Shutting down: Master
May  8 01:28:48 ip-172-31-7-112 web: [2022-05-08 01:28:48 +0000] [4971] [INFO] Reason: Worker failed to boot.
May  8 01:28:49 ip-172-31-7-112 web: [2022-05-08 01:28:49 +0000] [4985] [INFO] Starting gunicorn 20.1.0
May  8 01:28:49 ip-172-31-7-112 web: [2022-05-08 01:28:49 +0000] [4985] [INFO] Listening at: http://127.0.0.1:8000 (4985)
May  8 01:28:49 ip-172-31-7-112 web: [2022-05-08 01:28:49 +0000] [4985] [INFO] Using worker: gthread
May  8 01:28:49 ip-172-31-7-112 web: [2022-05-08 01:28:49 +0000] [4991] [INFO] Booting worker with pid: 4991
May  8 01:28:49 ip-172-31-7-112 web: [2022-05-08 01:28:49 +0000] [4991] [ERROR] Exception in worker process

我确定我的应用程序文件被命名为“application.py”并且应用程序也被命名为“application”

from flask import Flask, Response, render_template
from boto3 import client

application = Flask(__name__)

...

if __name__ == "__main__":
    application.run(debug=True)

我也查看了requirement.txt,找到了flask的信息

Flask==2.0.3
flask==2.0.3 # at first I think it is an uppercase/lowercase issue, so I add the 'flask==2.0.3'

我的 python.config 文件:

option_settings:
  "aws:elasticbeanstalk:container:python":
    WSGIPath: application:application

我问了这个问题,现在我解决了,所以我想分享一下我是如何解决这个问题的。

首先,我尝试通过调整包的版本来修复此错误,因为日志提供了有关此问题的更多详细信息,如下所示:

The conflict is caused by:
    The user requested botocore==1.25.9
    aiobotocore 2.3.1 depends on botocore<1.24.22 and >=1.24.21

但是,它不起作用。 每次调整版本都会出现新的package依赖问题。

因此,我卸载了 Pycharm 上的所有软件包,并一一安装,以确保我的应用程序可以在我的本地 PC 上运行。 接下来,我通过命令创建一个新的“requirements.txt”文件

pip freeze > requirements.txt

然后,我 zip 所有需要的文件并在 AWS 上部署我的应用程序。 有用。 健康状况还可以。

暂无
暂无

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

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