【问题标题】:Error occurred during build: Command setuptools failed构建期间发生错误:命令 setuptools 失败
【发布时间】:2020-09-15 10:14:39
【问题描述】:

我正在尝试在 AWS 上部署一个应用程序,但遇到了这个错误并且找不到如何让它工作。

错误:

构建期间发生错误:命令 setuptools 失败

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 没有可安装的 postgresql93-devel

db-migrate.congi

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

【问题讨论】:

    标签: amazon-web-services amazon-elastic-beanstalk setuptools


    【解决方案1】:

    这会失败,因为文件 /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 的一般迁移步骤:

    【讨论】:

    • 但我过去使用相同的命令部署了 2 个其他应用程序。它之前从未显示过该错误
    • @RahulSharma 也许您使用过 Amazon Linux 1?
    • 是的,你是对的!我刚刚检查了版本,它只是“Amazon Linux”,虽然部署现在卡在“构建期间发生错误:命令 01_migrate 失败”你也能帮忙吗?我已经分享了所有的 ebextension 文件
    • @RahulSharma AL1 和 AL2 之间有许多重大变化。 AWS 写了一个migration guide。应该会有帮助。
    • @RahulSharma 我用链接更新了答案。对于新问题,我不知道它为什么失败。您必须提供来自日志的错误消息。如果您有日志,您可以根据需要提出新问题,并提供与新问题相关的具体细节。
    猜你喜欢
    • 1970-01-01
    • 2014-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-19
    • 2017-12-26
    • 2020-01-30
    • 2018-02-18
    相关资源
    最近更新 更多