4
votes

I just spin up some environment using EB with python 3.4 and Django but it keeps failing, looks like the error occurs when installing using pip install -r requirements.txt this are the events from the web console:

Time    Type    Details
2017-10-06 20:22:39 UTC-0600    WARN    Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 69 seconds ago and took 14 minutes.
2017-10-06 20:22:20 UTC-0600    ERROR   Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
2017-10-06 20:21:17 UTC-0600    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2017-10-06 20:21:17 UTC-0600    ERROR   [Instance: i-0b46caf0e3099458c] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) 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. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2017-10-06 20:21:14 UTC-0600    ERROR   Your requirements.txt is invalid. Snapshot your logs for details.

I followed this tutorial: django-elastic-beanstalk-django and deploying-a-django-app-and-postgresql-to-aws-elastic-beanstalk on both I'm stuck at the same step

1
use the latest AMI 2017-09 which supported Python 3Bui Anh Tuan
How can I use an AMI in Eb?Marco Herrarte
Find the AMI ID that you want to use. Then in EB replace the default AMI ID with the one that you want.John Hanley
Could someone write out a slightly more complete set of instructions? Like go to the console and find an instance I already have and then use that AMI? I can find the AMI IDs of my instances via the EC2 console but it has python34 in the ID. I'm getting the same errors with it trying to use python2.7 when I deploy...Hendy

1 Answers

2
votes

I had an exact same problem. Here is the solution I found:

  1. Go to your env's configuration
  2. Click the conf button of Instances
  3. Under Server section, check your Custom AMI ID

For now, leave the page and go to AWS EC2 Console page

  1. Press Launch Instance
  2. You will now be on Step 1: Choose an Amazon Machine Image (AMI)
  3. Tada! You will see these ami ids that you can choose from: AMI-IDs

  4. Go back to no.3 and fill up the Custom AMI ID, refer from no.6 (FYI, I used amazon linux, but it is up to you to decide)

  5. Click Apply and wait till the configuration is done
  6. Re-follow the deploying django app
  7. DONE!