0

我想使用ElasticBeanStalk來放置一個基於Django的WebApp,但是在部署過程中,我發現有一些錯誤,請檢查日誌文件。我搜索了日誌文件但無法理解錯誤,Can有人幫我理解發生了什麼?AWS ElasticBeanStalk錯誤

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 [email protected]/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity failed. 
[2017-04-18T02:06:43.630Z] INFO [3334] - [Application update [email protected]/AppDeployStage0/AppDeployPreHook] : Activity failed. 
[2017-04-18T02:06:43.630Z] INFO [3334] - [Application update [email protected]/AppDeployStage0] : Activity failed. 
[2017-04-18T02:06:43.631Z] INFO [3334] - [Application update [email protected]] : 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 

我正在使用Pycharm進行開發,但使用了pip freeze命令來生成這些需求。

Update1:​​我刪除了一些需求併成功部署,但在嘗試從鏈接訪問Web應用程序時出現Server 500錯誤。

回答

0

Elastic Beanstalk試圖逐個安裝您的requirements.txt項目,但它停在「egg_info」處。這是錯誤:

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

我猜你沒有使用虛擬環境進行本地開發。這就是爲什麼你看到你的requirements.txt所有不必要的物品:

你有兩個選擇:

  1. 嘗試安裝(或刪除)該手動您的實例(一一後遇到錯誤的人每次部署失敗)。要做到這一點,你必須直接連接到你的EC2,然後pip installsudo pip install他們。您可能必須重複該過程幾次。

  2. (無法儘快切換到此方法)創建一個簡單的virtualenv並選擇真正需要的需求,然後再次嘗試部署。

要創建新的環境:

cd my_app 

virtualenv . 

激活ENV:

source bin/activate 

創造新requirement.txt

pip freeze > requirements.txt 

只添加必要的項目給它,並做了!

相關問題