[英]ERROR: ResolutionImpossible error when deploying web application on AWS Beanstalk
Update:更新:
2022.05.08 I renamed the "requirement.txt" as "requirements.txt". 2022.05.08 我将“requirement.txt”重命名为“requirements.txt”。 But it cannot solve my problem.
但它不能解决我的问题。 Now, new error information is
现在,新的错误信息是
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
Here is more information这里有更多信息
health cause:健康事业:
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.
first 10 lines(requirements file), this file was created by the command "pip freeze > requirements.txt"前 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
so, the packages that cannot be installed are: "aiobotocore", "botocore", and "boto3".因此,无法安装的软件包是:“aiobotocore”、“botocore”和“boto3”。
It seems so wired.看起来很连线。 "boto3" is a Python SDK for AWS, why it cannot be supported by AWS Elastic Beanstalk?
“boto3”对于 AWS 来说是 Python SDK,为什么 AWS Elastic Beanstalk 不支持它?
I created a flask application to download files from S3.我创建了一个 flask 应用程序来从 S3 下载文件。 it worked well on my local PC, but I meet the 'Health: severe' problem when I tried to deploy my code on AWS Elastic Beanstalk.
它在我的本地 PC 上运行良好,但当我尝试在 AWS Elastic Beanstalk 上部署我的代码时遇到“健康:严重”问题。
I checked the log and find this:我检查了日志并发现了这个:
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
I'm sure my application file is named as "application.py" and the application also is named as "application"我确定我的应用程序文件被命名为“application.py”并且应用程序也被命名为“application”
from flask import Flask, Response, render_template
from boto3 import client
application = Flask(__name__)
...
if __name__ == "__main__":
application.run(debug=True)
I also checked the requirement.txt and find the flask information我也查看了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'
My python.config file:我的 python.config 文件:
option_settings:
"aws:elasticbeanstalk:container:python":
WSGIPath: application:application
I asked this question and now I solve it, so I want to share how I address this problem.我问了这个问题,现在我解决了,所以我想分享一下我是如何解决这个问题的。
First, I tried to fix this error by adjusting the package's version because the log provides more details about this issue like this:首先,我尝试通过调整包的版本来修复此错误,因为日志提供了有关此问题的更多详细信息,如下所示:
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
However, it doesn't work.但是,它不起作用。 Each time I adjust the version, a new package dependency issue arises.
每次调整版本都会出现新的package依赖问题。
So, I uninstalled all packages on Pycharm and install them one by one to make sure my application can run on my local PC.因此,我卸载了 Pycharm 上的所有软件包,并一一安装,以确保我的应用程序可以在我的本地 PC 上运行。 Next, I create a new 'requirements.txt' file by command
接下来,我通过命令创建一个新的“requirements.txt”文件
pip freeze > requirements.txt
Then, I zip all the needed files and deploy my application on AWS.然后,我 zip 所有需要的文件并在 AWS 上部署我的应用程序。 It works.
有用。 The health status is OK.
健康状况还可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.