Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an application I need to host in Elastic Beanstock. The app requires Python 2.7 but Elastic Beanstock only supports Python 2.6.

I would like to install Python 2.7 on deploy. Here is the config.

.ebextensions/config:

packages:                                                                                                                                                                                                                                                      
  yum:                                                                                                                                                                                                                                                         
    python27.x86_64: '2.7.3'                                                                                                                                                                                                                                   

container_commands:                                                                                                                                                                                                                                            
  01create_virtual_environment:                                                                                                                                                                                                                                
    command: "virtualenv -p /usr/bin/python27 /opt/python/run/venv27"                                                                                                                                                                                          
  02activate:                                                                                                                                                                                                                                                  
    command: "source /opt/python/run/venv27/bin/activate"                                                                                                                                                                                                      
  02install_packages:                                                                                                                                                                                                                                          
    command: "pip install -r /opt/python/current/app/requirements.txt"

When I create the application, I get:

ERROR: Responses from [xxxxxxxx] were received, but the commands failed.

When I ssh in, I don't see the package.

Ideas?

share|improve this question

migrated from stackoverflow.com Jun 13 '13 at 6:09

This question came from our site for professional and enthusiast programmers.

From http://leetreveil.roon.io/getting-a-python-2-7-project-running-on-elastic-beanstalk:

Here’s the .ebextensions/python27.config I've written to get everything set up. I’ll explain what each part of the config does inline.

# Yum install the packages we need for python2.7
# on the EC2 box. python27-devel, make and httpd-devel
# are required for getting modwsgi setup with python27.
packages: 
  yum:
    python27: []
    python27-devel: []
    make: []
    httpd-devel: []

commands:
  # The modwsgi version currently installed on the system
  # is built with support for python2.6 only. This
  # command compiles and installs modwsgi with python2.7 support.
  installmodwsgi27:
    command: '[ -f mod_wsgi-3.4.tar.gz ] && echo "mod_wsgi-3.4 is already installed" || { wget http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz; tar xzvf mod_wsgi-3.4.tar.gz; cd mod_wsgi-3.4; ./configure --with-python=python27; make; make install; } | iconv -f utf-8 -t us-ascii//TRANSLIT'

  # When our app is being deployed a virtualenv is setup
  # automatically for us. This injects the --python=python2.7
  # argument into the virtualenv CLI. This tells virtualenv to
  # use python2.7 instead of the default python2.6.
  usepython27:
    command: grep "python2.7" 03deploy.py || sed -i 's/--distribute/--python=python2.7 &/' 03deploy.py
    cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre

container_commands:
  # Now that our app is installed using python2.7 we
  # need to fix some paths that the wsgi configuration
  # has pointing to python2.6. Copy the default eb wsgi.conf,
  # check it into git and replace the paths pointing
  # to python2.6. Check this diff out for the changes required:
  # https://github.com/leetreveil/elasticbeanstalk-python27/commit/3b3c955cfe686b9df77e0dddaf299ce6e1a20f32
  01replacewsgiconf:
    command: scp /opt/python/ondeck/app/wsgi.conf /opt/python/ondeck/wsgi

The author also has a Git repo with all the scripts and files necessary to set this up.

share|improve this answer

similar situation is described here with details on how to solve

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

share|improve this answer
1  
Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Canadian Luke Jun 13 '13 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .