构建期间发生错误:命令 setuptools 失败
Error occurred during build: Command setuptools failed
我正在尝试在 AWS 上部署一个应用程序,但遇到了这个错误,找不到如何让它工作。
错误:
Error occurred during build: Command setuptools failed
01_packages.config
packages:
yum:
git: []
postgresql-devel: []
libjpeg-turbo-devel: []
commands:
setuptools:
command: /opt/python/run/venv/bin/pip install setuptools --upgrade
我猜最近 AWS 发生了变化,因为这在我之前的部署中有效。
我也不得不改变
postgresql93-devel: []
到
postgresql-devel: []
因为之前报错如下:
Yum does not have postgresql93-devel available for installation
db-migrate.congig
container_commands:
01_migrate:
command: "django-admin.py migrate --noinput"
leader_only: true
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: app_name.settings
django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: yantraksh_cargo/wsgi.py
wsgi_custom.config
files:
"/etc/httpd/conf.d/wsgihacks.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIPassAuthorization On
这失败了,因为文件 /opt/python/run/venv/bin/pip
不存在 。至少在 Amazon Linux 2 (python env) 上是这样。
要解决这个问题,您可以使用
commands:
setuptools:
command: pip install setuptools --upgrade
为了检查它是否有效,我在测试 EB 环境中 验证了 它 (64bit Amazon Linux 2 v3.0.1 running Python 3.7
):
2020-05-28 07:47:14,369 P3704 [INFO] Command setuptools
2020-05-28 07:47:16,759 P3704 [INFO] -----------------------Command Output-----------------------
2020-05-28 07:47:16,759 P3704 [INFO] Collecting setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Downloading setuptools-46.4.0-py3-none-any.whl (583 kB)
2020-05-28 07:47:16,759 P3704 [INFO] Installing collected packages: setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Attempting uninstall: setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Found existing installation: setuptools 38.4.0
2020-05-28 07:47:16,759 P3704 [INFO] Uninstalling setuptools-38.4.0:
2020-05-28 07:47:16,760 P3704 [INFO] Successfully uninstalled setuptools-38.4.0
2020-05-28 07:47:16,760 P3704 [INFO] Successfully installed setuptools-46.4.0
编辑:
Amazon Linux 1 到 2 的一般迁移步骤概述如下:
我正在尝试在 AWS 上部署一个应用程序,但遇到了这个错误,找不到如何让它工作。
错误:
Error occurred during build: Command setuptools failed
01_packages.config
packages:
yum:
git: []
postgresql-devel: []
libjpeg-turbo-devel: []
commands:
setuptools:
command: /opt/python/run/venv/bin/pip install setuptools --upgrade
我猜最近 AWS 发生了变化,因为这在我之前的部署中有效。
我也不得不改变
postgresql93-devel: []
到
postgresql-devel: []
因为之前报错如下:
Yum does not have postgresql93-devel available for installation
db-migrate.congig
container_commands:
01_migrate:
command: "django-admin.py migrate --noinput"
leader_only: true
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: app_name.settings
django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: yantraksh_cargo/wsgi.py
wsgi_custom.config
files:
"/etc/httpd/conf.d/wsgihacks.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIPassAuthorization On
这失败了,因为文件 /opt/python/run/venv/bin/pip
不存在 。至少在 Amazon Linux 2 (python env) 上是这样。
要解决这个问题,您可以使用
commands:
setuptools:
command: pip install setuptools --upgrade
为了检查它是否有效,我在测试 EB 环境中 验证了 它 (64bit Amazon Linux 2 v3.0.1 running Python 3.7
):
2020-05-28 07:47:14,369 P3704 [INFO] Command setuptools
2020-05-28 07:47:16,759 P3704 [INFO] -----------------------Command Output-----------------------
2020-05-28 07:47:16,759 P3704 [INFO] Collecting setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Downloading setuptools-46.4.0-py3-none-any.whl (583 kB)
2020-05-28 07:47:16,759 P3704 [INFO] Installing collected packages: setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Attempting uninstall: setuptools
2020-05-28 07:47:16,759 P3704 [INFO] Found existing installation: setuptools 38.4.0
2020-05-28 07:47:16,759 P3704 [INFO] Uninstalling setuptools-38.4.0:
2020-05-28 07:47:16,760 P3704 [INFO] Successfully uninstalled setuptools-38.4.0
2020-05-28 07:47:16,760 P3704 [INFO] Successfully installed setuptools-46.4.0
编辑:
Amazon Linux 1 到 2 的一般迁移步骤概述如下: