简体   繁体   English

AWS ElasticBeanStalk错误

[英]AWS ElasticBeanStalk Error

I am trying to put a Django based WebApp using ElasticBeanStalk,However in the middle of deployment, I get that there is some error,Please check Log file.I searched the log file but cannot understand the error,Can anybody help me to understand what is happening? 我正在尝试使用ElasticBeanStalk放置基于Django的WebApp,但是在部署过程中,我发现有些错误,请检查日志文件。我搜索了日志文件,但无法理解该错误,有人可以帮助我了解什么正在发生?

Logs:
 * The following required packages can not be built:
 * freetype

      ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-n5etdtzo/matplotlib/
  2017-04-18 02:06:43,611 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
      install_dependencies()
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
      check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
    File "/usr/lib64/python2.7/subprocess.py", line 541, 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 (ElasticBeanstalk::ExternalInvocationError)
caused by: Requirement already satisfied: appdirs==1.4.3 in /opt/python/run/venv/lib/python3.4/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1))
  Requirement already satisfied: aws-requests-auth==0.3.0 in /opt/python/run/venv/lib/python3.4/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 2))
  Collecting awscli==1.11.61 (from -r /opt/python/ondeck/app/requirements.txt (line 3))
    Using cached awscli-1.11.61-py2.py3-none-any.whl
  Collecting awsebcli==3.10.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))
    Using cached awsebcli-3.10.0.tar.gz
  Collecting backports.ssl-match-hostname==3.5.0.1 (from -r /opt/python/ondeck/app/requirements.txt (line 5))
    Using cached backports.ssl_match_hostname-3.5.0.1.tar.gz
  Collecting bdist-mpkg==0.5.0 (from -r /opt/python/ondeck/app/requirements.txt (line 6))
    Using cached bdist_mpkg-0.5.0.tar.gz
  Collecting blessed==1.14.1 (from -r /opt/python/ondeck/app/requirements.txt (line 7))
    Using cached blessed-1.14.1-py2.py3-none-any.whl
  Requirement already satisfied: boto3==1.4.4 in /opt/python/run/venv/lib/python3.4/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 8))
  Collecting botocore==1.5.24 (from -r /opt/python/ondeck/app/requirements.txt (line 9))
    Using cached botocore-1.5.24-py2.py3-none-any.whl
  Collecting cement==2.8.2 (from -r /opt/python/ondeck/app/requirements.txt (line 10))
    Using cached cement-2.8.2.tar.gz
  Collecting colorama==0.3.7 (from -r /opt/python/ondeck/app/requirements.txt (line 11))
    Using cached colorama-0.3.7-py2.py3-none-any.whl
  Requirement already satisfied: Django==1.10.6 in /opt/python/run/venv/lib/python3.4/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 12))
  Collecting django-extensions==1.7.7 (from -r /opt/python/ondeck/app/requirements.txt (line 13))
    Using cached django_extensions-1.7.7-py2.py3-none-any.whl
  Collecting django-extensions-shell==1.7.4.1 (from -r /opt/python/ondeck/app/requirements.txt (line 14))
    Using cached django_extensions_shell-1.7.4.1-py2.py3-none-any.whl
  Collecting docker-py==1.7.2 (from -r /opt/python/ondeck/app/requirements.txt (line 15))
    Using cached docker-py-1.7.2.tar.gz
  Collecting dockerpty==0.4.1 (from -r /opt/python/ondeck/app/requirements.txt (line 16))
    Using cached dockerpty-0.4.1.tar.gz
  Collecting docopt==0.6.2 (from -r /opt/python/ondeck/app/requirements.txt (line 17))
    Using cached docopt-0.6.2.tar.gz
  Requirement already satisfied: docutils==0.13.1 in /opt/python/run/venv/lib/python3.4/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 18))
  Collecting elasticsearch==5.2.0 (from -r /opt/python/ondeck/app/requirements.txt (line 19))
    Using cached elasticsearch-5.2.0-py2.py3-none-any.whl
  Collecting futures==3.0.5 (from -r /opt/python/ondeck/app/requirements.txt (line 20))
    Using cached futures-3.0.5.tar.gz
  Requirement already satisfied: jmespath==0.9.2 in /opt/python/run/venv/lib/python3.4/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 21))
  Collecting macholib==1.5.1 (from -r /opt/python/ondeck/app/requirements.txt (line 22))
    Using cached macholib-1.5.1.tar.gz
  Collecting matplotlib==1.3.1 (from -r /opt/python/ondeck/app/requirements.txt (line 23))
    Using cached matplotlib-1.3.1.tar.gz
      Complete output from command python setup.py egg_info:
      ============================================================================
      Edit setup.cfg to change the build options

      BUILDING MATPLOTLIB
                  matplotlib: yes [1.3.1]
                      python: yes [3.4.3 (default, Sep  1 2016, 23:33:38)  [GCC
                              4.8.3 20140911 (Red Hat 4.8.3-9)]]
                    platform: yes [linux]

      REQUIRED DEPENDENCIES AND EXTENSIONS
                       numpy: yes [not found. pip may install it below.]
                    dateutil: yes [using dateutil version 2.6.0]
                     tornado: yes [tornado was not found. It is required for the
                              WebAgg backend. pip/easy_install may attempt to
                              install it after matplotlib.]
                   pyparsing: yes [using pyparsing version 2.2.0]
                       pycxx: yes [Official versions of PyCXX are not compatible
                              with Python 3.x.  Using local copy]
                      libagg: yes [pkg-config information for 'libagg' could not
                              be found. Using local copy.]
                    freetype: no  [pkg-config information for 'freetype2' could
                              not be found.]
                         png: yes [pkg-config information for 'libpng' could not
                              be found. Using unknown version.]

      OPTIONAL SUBPACKAGES
                 sample_data: yes [installing]
                    toolkits: yes [installing]
                       tests: yes [nose 0.11.1 or later is required to run the
                              matplotlib test suite]

      OPTIONAL BACKEND EXTENSIONS
                      macosx: no  [Mac OS-X only]
                      qt4agg: no  [PyQt4 not found]
                     gtk3agg: no  [gtk3agg backend does not work on Python 3]
                   gtk3cairo: no  [Requires cairo to be installed.]
                      gtkagg: no  [Requires pygtk]
                       tkagg: no  [TKAgg requires Tkinter.]
                       wxagg: no  [requires wxPython]
                         gtk: no  [Requires pygtk]
                         agg: yes [installing]
                       cairo: no  [cairo not found]
                   windowing: no  [Microsoft Windows only]

      OPTIONAL LATEX DEPENDENCIES
                      dvipng: no
                 ghostscript: no
                       latex: no
                     pdftops: no

      ============================================================================
                              * The following required packages can not be built:
                              * freetype

      ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-n5etdtzo/matplotlib/
  2017-04-18 02:06:43,611 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
      install_dependencies()
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
      check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
    File "/usr/lib64/python2.7/subprocess.py", line 541, 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 (Executor::NonZeroExitStatus)


[2017-04-18T02:06:43.630Z] INFO  [3334]  - [Application update 7@5/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity failed.
[2017-04-18T02:06:43.630Z] INFO  [3334]  - [Application update 7@5/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2017-04-18T02:06:43.630Z] INFO  [3334]  - [Application update 7@5/AppDeployStage0] : Activity failed.
[2017-04-18T02:06:43.631Z] INFO  [3334]  - [Application update 7@5] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed
[2017-04-18T02:07:43.802Z] INFO  [3482]  - [CMD-BundleLogs] : Starting activity...
[2017-04-18T02:07:43.802Z] INFO  [3482]  - [CMD-BundleLogs/AddonsBefore] : Starting activity...
[2017-04-18T02:07:43.802Z] INFO  [3482]  - [CMD-BundleLogs/AddonsBefore] : Completed activity.
[2017-04-18T02:07:43.803Z] INFO  [3482]  - [CMD-BundleLogs/BundleLogs] : Starting activity...
[2017-04-18T02:07:43.803Z] INFO  [3482]  - [CMD-BundleLogs/BundleLogs/BundleLogs] : Starting activity...



My requirements.txt file is
appdirs==1.4.3
aws-requests-auth==0.3.0
awscli==1.11.61
awsebcli==3.10.0
backports.ssl-match-hostname==3.5.0.1
bdist-mpkg==0.5.0
blessed==1.14.1
boto3==1.4.4
botocore==1.5.24
cement==2.8.2
colorama==0.3.7
Django==1.10.6
django-extensions==1.7.7
django-extensions-shell==1.7.4.1
docker-py==1.7.2
dockerpty==0.4.1
docopt==0.6.2
docutils==0.13.1
elasticsearch==5.2.0
futures==3.0.5
jmespath==0.9.2
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
numpy==1.8.0rc1
oauthlib==2.0.1
packaging==16.8
pathspec==0.5.0
py2app==0.7.3
pyasn1==0.2.3
pyparsing==2.2.0
pysolr==3.6.0
python-dateutil==2.6.0
pytz==2013.7
PyYAML==3.12
requests==2.9.1
requests-oauthlib==0.8.0
rsa==3.4.2
s3transfer==0.1.10
scipy==0.13.0b1
semantic-version==2.5.0
six==1.10.0
tabulate==0.7.5
termcolor==1.1.0
tweepy==3.5.0
urllib3==1.20
vboxapi==1.0
virtualenv==15.1.0
watson-developer-cloud==0.25.2
wcwidth==0.1.7
websocket-client==0.40.0
xattr==0.6.4
zope.interface==4.1.1

I am using Pycharm for the development but used pip freeze command to generate these requirements. 我正在使用Pycharm进行开发,但是使用了pip Frozen命令来生成这些需求。

Update1: I removed some requirements and it deployed successfully but I am getting Server 500 error when trying to access the webapp from the link. Update1:​​我删除了一些要求,并成功部署了它,但是在尝试从链接访问Web应用程序时出现Server 500错误。

Elastic Beanstalk is trying to install your requirements.txt items one by one, but it stops at "egg_info". Elastic Beanstalk试图一一安装您的requirements.txt项目,但它在“ egg_info”处停止。 Here is the error: 这是错误:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-n5etdtzo/matplotlib/

I'm guessing that you are not using a virtual environment for your local development. 我猜您在本地开发中没有使用虚拟环境。 That's why you see all unnecessary items in your requirements.txt : 这就是为什么您在requirements.txt中看到所有不必要的项目的原因:

You have two options: 您有两种选择:

  1. Try installing (or removing) the ones that run into error manually on your instance (one by one after each failed deployment). 尝试在您的实例上手动安装(或删除)遇到错误的实例(每次部署失败后一个接一个)。 To do this, you have to connect to your EC2 directly and then pip install or maybe sudo pip install them. 为此,您必须直接连接到EC2,然后进行pip installsudo pip install它们。 You will probably have to repeat the process a few times. 您可能需要重复几次该过程。

  2. (Cannot switch to this method soon enough) Create a simple virtualenv and pick the requirements that are REALLY needed and then try your deployment again. (无法尽快切换到此方法)创建一个简单的virtualenv并选择真正需要的要求,然后再次尝试进行部署。

To create new environment: 创建新环境:

cd my_app

virtualenv .

Activate the env: 激活环境:

source bin/activate

create new requirement.txt 创建新的require.txt

pip freeze > requirements.txt

add only the NECESSARY items to it, and done! 仅添加NECESSARY项目,并完成!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM