4
votes

When I try to deploy my Amazon Web Services Elastic Beanstalk project (Python + Django), I get the following error:

 2016-09-14 14:46:37,244 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 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 (Executor::NonZeroExitStatus)

I had this error a few months ago and I simply changed my configuration in .ebextensions which enabled the deployment to work correctly (problem was postgresql93-devel missing):

packages:
    yum:
        git: []
        postgresql93-devel: []
        libffi-devel: []

I guess AWS has an issue with one or more of my libraries in requirements.txt- I tried installing/deinstalling some of them to find the one that causes the troubles, but haven't managed yet. This is my requirements.txt:

awsebcli==3.7.7
beautifulsoup4==4.4.1
boto==2.40.0
botocore==1.4.40
cement==2.8.2
cffi==1.5.2
colorama==0.3.7
cryptography==1.3.1
Django==1.9.4
django-storages==1.4.1
docker-py==1.7.2
dockerpty==0.4.1
docopt==0.6.2
docutils==0.12
enum34==1.1.2
future==0.15.2
futures==3.0.5
gax-google-logging-v2==0.8.1
gax-google-pubsub-v1==0.8.1
google-api-python-client==1.5.0
google-gax==0.13.0
googleads==3.13.0
googleapis-common-protos==1.3.4
grpc-google-logging-v2==0.8.1
grpc-google-pubsub-v1==0.8.1
grpcio==1.0.0
httplib2==0.9.2
idna==2.1
ipaddress==1.0.16
jmespath==0.9.0
oauth2client==2.0.1
pathspec==0.3.4
ply==3.8
protobuf==3.0.0
psycopg2==2.6.1
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycparser==2.14
pyOpenSSL==16.0.0
PySocks==1.5.6
python-dateutil==2.5.3
pytz==2016.2
PyYAML==3.11
requests==2.9.1
rsa==3.4
s3transfer==0.1.4
semantic-version==2.5.0
simplejson==3.8.2
six==1.10.0
suds-jurko==0.6
texttable==0.8.4
uritemplate==0.6
websocket-client==0.37.0
xmltodict==0.10.1

My guess is that the issue comes from one of these libraries (but I might be wrong!):

future==0.15.2
futures==3.0.5
gax-google-logging-v2==0.8.1
gax-google-pubsub-v1==0.8.1
google-gax==0.13.0
googleapis-common-protos==1.3.4
grpc-google-logging-v2==0.8.1
grpc-google-pubsub-v1==0.8.1
grpcio==1.0.0
ply==3.8
protobuf==3.0.0
s3transfer==0.1.4

The Django project works perfectly locally. My issue is only with the AWS Elastic Beanstalk deployment.

Please let me know if you have any idea.

1
Simple question: do you have "requirements.txt" file in your app folder? (it must be named exactly that way and being in the project root)daveoncode
Yes, it is at the root. Please have a look here at my structure: s14.postimg.org/fqw09unsh/elastic_beanstalk.jpgeagle28
Sorry, I'm an idiot I didn't read carefully the post... by reading the error, the requirements.txt is found but there are errors during the installation... unfortunately there are no useful information in the stacktrace... my guesses are: 1. missing dependencies on the OS level (system libraries) 2. missing/wrong environment variablesdaveoncode
I went back to a previous GIT version and did everything step by step to add my new features. I am not sure what is the problem, but it seems to come from one of these libraries: future==0.15.2, grpcio==1.0.0, ply==3.8, protobuf==3.0.0 -- I removed them and everything works fine. Not sure why they were installed.eagle28
For anyone who runs to the same issue in the future: try requesting the last 100 logs from your beanstalk console. In there it specifically explains which of the requirements failed to install.morinx

1 Answers

2
votes

I see the same issue here, it's the future library. If you look at the AWS EB server error log (/var/log/httpd/error_log) you can see the error.

python3 / django2 dont play well with future module, but wasebcli insists on it.

I solve it here by NOT installing awsebcli to the virtual environment. You then need to deploy using the local environment (where awsebcli is installed).

Seems like we should have an update for AWSEBCLI to solve this eventually.