Skip to content

Instantly share code, notes, and snippets.

@nicolashery
Created September 8, 2012 22:35
Show Gist options
  • Save nicolashery/3680445 to your computer and use it in GitHub Desktop.
Save nicolashery/3680445 to your computer and use it in GitHub Desktop.
Deploy Python app using Pandas on Heroku

Deploy Python app using Pandas on Heroku

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.log

It 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.2

Deploy:

$ heroku create appname
$ git add .
$ git commit -m "Add numpy as requirement"
$ git push heroku master

Numpy builds without any problems. Second, add Pandas as a requirement:

flask==0.8
numpy==1.6.2
pandas==0.8.1

Commit and update the app:

$ git add .
$ git commit -m "Add pandas as requirement"
$ git push heroku master

Numpy is already installed, Pandas should install correctly now.

Hope this helps!

@Mirzaf25
Copy link

same problem but this solution didnt work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment