Deploying Django project, running on Python 3.6, o

2019-09-01 03:35发布

问题:

I have done this before too using Python2.7 using this resource

But, this error is new to me

Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1

This following is the detailed traceback

(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)

I don't understand what the issue seems to be.

Would love any direction possible.

回答1:

You've installed a Python 2 package but you're using Python 3.

The concurrent.futures library is included in the standard library in Python 3. You should remove it frmo your requirements.txt.



回答2:

This problem was a facade.

The issue wasn't in the requirements.txt as mentioned in the traceback but in the SSL key. My SSL key was corrupted and hence it was showing me this error.

In my opinion, these errors are caused due to discrepancy in:

  • configuration files such as key.pem, .ebextension/* files
  • project packages such as postgresql93-devel, git etc

Hope this is of some helps some of you.