遵循教程AWS Elastic Beanstalk的Flask教程

时间:2016-08-11 09:54:13

标签: python elastic-beanstalk

我正在关注AWS Elastic Beanstalk的Flask tutorial来部署示例应用程序。

虽然我收到错误您的requirements.txt无效 - 完整如下。虽然我没有为我提供有用的解决方案,但我google出现此错误。

我的 requirements.txt 文件粘贴在以下部分中。我正在使用 Ubuntu Desktop 16.04

您可以按照本教程继续部署,但请分享。谢谢。

错误

ERROR: Your requirements.txt is invalid. Snapshot your logs for details.
ERROR: [Instance: i-c78c8f57] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
  File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
  CalledProcessError:
    Command
    '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt'
    returned non-zero exit status 1.
  Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed.
  For more detail, check /var/log/eb-activity.log using console or EB CLI.

INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
WARN: Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 45 seconds ago and took 3 minutes.
ERROR: Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

requirements.txt

click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
pkg-resources==0.0.0
Werkzeug==0.11.10

1 个答案:

答案 0 :(得分:2)

我在本地测试并能够复制您的问题。为了获得有关实例出错的更多信息,我使用eb logs来查看当前EC2实例上的日志。从那以后,我能够在eb-activity.log

中看到完整的堆栈
 Collecting pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))
    Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4)) (from versions: )
  No matching distribution found for pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))

我不确定pkg-resources=0.0.0来自哪里,但它不是pip中的有效包。我能够删除该行并成功部署。

您可能需要验证pip freeze的输出,并查看该库是否确实存在。