简体   繁体   中英

ERROR: ResolutionImpossible error when deploying web application on AWS Beanstalk

Update:

2022.05.08 I renamed the "requirement.txt" as "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"

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".

It seems so wired. "boto3" is a Python SDK for AWS, why it cannot be supported by AWS Elastic Beanstalk?


I created a flask application to download files from 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.

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"

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

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:

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.

So, I uninstalled all packages on Pycharm and install them one by one to make sure my application can run on my local PC. Next, I create a new 'requirements.txt' file by command

pip freeze > requirements.txt

Then, I zip all the needed files and deploy my application on AWS. It works. The health status is OK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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