使用ElasticBeanstalk在AWS上部署在Python 3.6上运行的Django项目

时间:2018-08-02 10:17:33

标签: python django amazon-web-services deployment elastic-beanstalk

在使用Python2.7和resource

之前,我也这样做过

但是,这个错误对我来说是新的

Error installing dependencies: 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: Traceback (most recent call last):
    File "/opt/python/run/venv/bin/pip", line 7, in <module>
      from pip import main
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/__init__.py", line 28, in <module>
      from pip.vcs import git, mercurial, subversion, bazaar  # noqa
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/vcs/subversion.py", line 9, in <module>
      from pip.index import Link
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/index.py", line 31, in <module>
      from pip.wheel import Wheel, wheel_ext
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/pip/wheel.py", line 6, in <module>
      import compileall
    File "/usr/lib64/python3.6/compileall.py", line 20, in <module>
      from concurrent.futures import ProcessPoolExecutor
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
      from concurrent.futures._base import (FIRST_COMPLETED,
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
      raise exception_type, self._exception, self._traceback
                          ^
  SyntaxError: invalid syntax
  2018-08-02 09:33:29,231 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 186, 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)

我不明白问题出在哪里。

会爱任何方向。

2 个答案:

答案 0 :(得分:2)

您已经安装了Python 2软件包,但您正在使用Python 3。

current.futures库包含在Python 3的标准库中。您应该从您的requirements.txt中删除它。

答案 1 :(得分:0)

这个问题是一个门面。

问题不在追溯中提到的requirements.txt中,而是在SSL密钥中。我的SSL密钥已损坏,因此正在向我显示此错误。

我认为,这些错误是由于以下方面的差异引起的:

  • 配置文件,例如key.pem,.ebextension / *文件
  • 项目包,例如postgresql93-devel,git等

希望这对您有些帮助。