title: Pandas + Django + mod_wsgi + virtualenv
body: <p>Pandas is producing <strong>'module' object has no attribute 'core'</strong> when being imported under <code>django</code> and <code>mod_wsgi</code> inside a virtual environment.  It works fine running under the <code>django</code> development server inside the virtual environment. </p>
  
  <p>Other modules e.g.: numpy have no problems so I assume this means the virtual environment is set up correctly with <code>mod_wsgi</code>.  Any advice would be appreciated.</p>
  
  <h3>staging.wsgi</h3>
  
  <pre><code>import os
  import sys
  import site
  
  PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
  site_packages = os.path.join(PROJECT_ROOT, 'env/openportfolio/lib/python2.7/site-packages')
  site.addsitedir(os.path.abspath(site_packages))
  sys.path.insert(0, PROJECT_ROOT)
  sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
  os.environ['DJANGO_SETTINGS_MODULE'] = 'openportfolio.settings_staging'
  
  import pandas #triggers error
  import django.core.handlers.wsgi
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>
  
  <h3>Error</h3>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/web/django/www/staging/openportfolio/apache/staging.wsgi", line 22, in &lt;module&gt;
      import pandas
    File "/usr/local/web/django/www/staging/env/openportfolio/lib/python2.7/site-packages/pandas/__init__.py", line 12, in &lt;module&gt;
      from pandas.core.api import *
    File "/usr/local/web/django/www/staging/env/openportfolio/lib/python2.7/site-packages/pandas/core/api.py", line 6, in &lt;module&gt;
      import pandas.core.datetools as datetools
    AttributeError: 'module' object has no attribute 'core'  
  </code></pre>
  
  <h3>Python Path</h3>
  
  <pre><code>['/usr/local/web/django/www/staging/openportfolio',
   '/usr/local/web/django/www/staging',
   '/Library/Python/2.7/site-packages/pip-1.0.2-py2.7.egg',
   '/usr/local/web/django/www/staging/env/openportfolio/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
   '/usr/local/web/django/www/staging/env/openportfolio/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg',
   '/usr/local/web/django/www/staging/env/openportfolio/lib/python2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
   '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
   '/Library/Python/2.7/site-packages',
   '/usr/local/web/django/www/staging/env/openportfolio/lib/python2.7/site-packages']
  </code></pre>