在使用requirements.txt文件为AWS Elastic Beanstalk中的flask-mysql应用程序安装依赖项时遇到错误。

7 浏览
0 Comments

在使用requirements.txt文件为AWS Elastic Beanstalk中的flask-mysql应用程序安装依赖项时遇到错误。

我正在尝试部署一个使用mysqlclient模块的flask应用程序。我在requirements.txt文件中添加了"mysqlclient==2.0.3",但是出现了以下错误:

希望能够得到解决方案,以解决这个问题并部署我的应用程序。

错误信息如下:

收集mysqlclient==2.0.3

下载mysqlclient-2.0.3.tar.gz (88 kB)

2021/04/30 14:51:41.371493 [ERROR] 在执行命令[app-deploy] - [InstallDependency]期间发生错误。停止运行该命令。错误: 使用requirements.txt文件安装依赖项失败,错误命令/bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt失败,退出状态1。错误输出:ERROR: Command errored out with exit status 1:

command: /var/app/venv/staging-LQM1lest/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ev789p02/mysqlclient_e4290fdb04994f22bf4d9325b9d91254/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ev789p02/mysqlclient_e4290fdb04994f22bf4d9325b9d91254/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-n398ytz1

cwd: /tmp/pip-install-ev789p02/mysqlclient_e4290fdb04994f22bf4d9325b9d91254/

完整输出(15行):

/bin/sh: mysql_config: 找不到命令

/bin/sh: mariadb_config: 找不到命令

/bin/sh: mysql_config: 找不到命令

Traceback (most recent call last):

File "", line 1, in

File "/tmp/pip-install-ev789p02/mysqlclient_e4290fdb04994f22bf4d9325b9d91254/setup.py", line 15, in

metadata, options = get_config()

File "/tmp/pip-install-ev789p02/mysqlclient_e4290fdb04994f22bf4d9325b9d91254/setup_posix.py", line 70, in get_config

libs = mysql_config("libs")

File "/tmp/pip-install-ev789p02/mysqlclient_e4290fdb04994f22bf4d9325b9d91254/setup_posix.py", line 31, in mysql_config

raise OSError("{} not found".format(_mysql_config_path))

OSError: 找不到mysql_config

mysql_config --version

mariadb_config --version

mysql_config --libs

----------------------------------------

警告: 丢弃https://files.pythonhosted.org/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz#sha256=f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432(来自https://pypi.org/simple/mysqlclient/)(要求-python:>= 3.5)。命令出错退出状态1: python setup.py egg_info 检查日志以获取完整的命令输出。

错误: 找不到满足要求mysqlclient==2.0.3的版本

错误: 找不到匹配的发行版本mysqlclient==2.0.3

2021/04/30 14:51:41.371508 [INFO] 执行清理逻辑

2021/04/30 14:51:41.371596 [INFO] CommandService 响应: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"引擎执行遇到错误。","returncode":1,"events":[{"msg":"实例部署失败,无法安装应用程序依赖项。部署失败。","timestamp":1619794301,"severity":"ERROR"},{"msg":"实例部署失败。详细信息请参见'eb-engine.log'。","timestamp":1619794301,"severity":"ERROR"}]}]}

0
0 Comments

在AWS Elastic Beanstalk上安装Flask-MySQL应用程序的依赖时遇到了错误。

问题的出现原因是因为在django项目中编辑了两个文件。

.ebextensions/packages.config文件内容如下:

packages:

yum:

python3-devel: []

mariadb-devel: []

requirements.txt文件内容如下:

...
mysqlclient // just remove ==2.0.3
...

解决方法是将requirements.txt文件中的"mysqlclient"的版本号"==2.0.3"删除掉。

0