簡體   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