2012-09-08
This document explains how to deploy a Python app that uses the Pandas library on Heroku.
Heroku builds Numpy (one of Pandas' requirements)
fine. However, when trying to deploy an app with both numpy and pandas in
its requirements.txt file (or even just pandas), for some reason it fails
when trying to install Pandas with the following error:
Downloading/unpacking pandas==0.8.1 (from -r requirements.txt (line 3))
 Storing download in cache at /app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpandas%2Fpandas-0.8.1.zip
 Running setup.py egg_info for package pandas
   # numpy needed to finish setup.  run:
   
       $ pip install numpy  # or easy_install numpy
   
   Complete output from command python setup.py egg_info:
   # numpy needed to finish setup.  run:
   $ pip install numpy  # or easy_install numpy
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /app/.pip/pip.logIt looks like Pandas' install doesn't wait for Numpy to be built or something, but I'm not really sure.
The workaround is to first, deploy the app with only Numpy as a requirement.
So requirements.txt looks like, in my example:
flask==0.8
numpy==1.6.2Deploy:
$ heroku create appname
$ git add .
$ git commit -m "Add numpy as requirement"
$ git push heroku masterNumpy builds without any problems. Second, add Pandas as a requirement:
flask==0.8
numpy==1.6.2
pandas==0.8.1Commit and update the app:
$ git add .
$ git commit -m "Add pandas as requirement"
$ git push heroku masterNumpy is already installed, Pandas should install correctly now.
Hope this helps!
You are a god, thank you!