title: How to use virtualenv system-site-packages on AWS Elastic Beanstalk?
body: <p>I have to work on an existing python (django) application that runs on AWS Elastic Beanstalk. It seems that all the requirements (from requirements.txt) are installed in a virtual env (I hope I'm right on that). My problem is that I have installed some libraries using yum. My dependencies config for my beanstalk instance looks like this:</p>
  
  <pre><code>packages:
   yum:
    python27-devel: []
    git: []
    nginx: []
    pcre-devel: []
    freetype-devel: []
    libpng-devel: []
    postgresql93-devel: []
    graphviz-devel: []
    blas-devel: []
    atlas-devel: []
    lapack-devel: []
    gcc-c++: []
    python27-numpy: []
    python27-matplotlib: []
    python27-psycopg2: []
  </code></pre>
  
  <p>As you can see I explicitly install some python libraries like numpy, matplotlib and psycopg2 but since my application seems to run in a virtual env these libraries are not accessible for my app so it crashes when launching. I got this type of errors:</p>
  
  <blockquote>
    <p>Command failed on instance. Return code: 1 Output: (TRUNCATED)....7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 20, in  raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2. container_command 01_migrate in .ebextensions/02-python.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.</p>
  </blockquote>
  
  <p>I've read that you can allow a virtual env to access the system libraries with the option system-site-packages but how to do so for a AWS elastic beanstalk instance?</p>
  
  <p>EDIT: What I don't want to do is installing numpy, matplotlib and psycopg2 with pip since it compiles everything and that's very long. It is why I want to install these libraries with yum, to get a precompiled version. And I want these installations to be automatic, I don't want to ssh on the machine to install things manually. This is where my problem appears. :)</p>
  
  <p>Thanks a lot for your time!</p>
  
  <p>(Sorry for my english, it's not my native language)</p>