Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. 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 a web mapping app running on Heroku. My app is written in python. Using pip I was able to install various pure python libraries that were needed. I would now like to install Shapely too. This is simple enough (with pip) but I am unsure how to install the geos pre-requisite within the virtualenv (venv) directory. I would much appreciate any pointers.

Thanks, John

share|improve this question
up vote 5 down vote accepted

Haven't tried, but found a tweet that looks promising

Seems like the concept of "buildpack" is a way to get things loaded on Heroku, and someone has made GEOS iavailable as a buildpack. By setting a custom geos-path you can install Shapely via pip and it will find GEOS.

share|improve this answer
Great thanks! I'll try it out and post back tomorrow. – John Steedman May 29 '13 at 19:40

You also install them using pip. You'll have to specify a requirements.txt file though. It's basically just a text file where you list the Python libraries you want to install. Just put the text file on the root of your repository. Once it's there, you can just run pip like so:

$pip install -r requirements.txt

Here's an example requirements.txt file


You can read more about it on the Heroku help page.

share|improve this answer
R.K. Thank you. I've been through that page. As you know my issue is that I don't know how to deal with Shapely's C++ dependency which is I believe called Does the answer lie in the "Local file-backed distributions" section of your link? – John Steedman May 29 '13 at 17:58
On my linux system I find that I have various libraries of GEOS with different version e.g. located in /usr/lib – John Steedman May 29 '13 at 18:28
This is an interesting question, shapely can be installed through pip, but depends on GEOS, which is c/++ and therefore (as far as I know) cannot be installed with pip. Manually installing GEOS on Heroku is not an option, which makes me suspect that shapely on Heroku is impossible. I would love to be corrected on this assumption – atlefren May 29 '13 at 19:01
I've done some more investigation. With Shapely if you type shapely.geos.geos_version_string you get the version number. I get: "3.3.3-CAPI-1.7.4". So I've located this library at /usr/lib/ . Now if I rename it, I can no longer type shapely.geos from python in the virtual environment. So I doubt that it will work on Heroku unless some other action is taken. – John Steedman May 29 '13 at 19:05
@atlefren, just saw your comment. Agree, I'll check with a guy who gave a talk on vitualenv and post back. – John Steedman May 29 '13 at 19:07

You can install geos as a vendored binary on Heroku. This blog post that I wrote details how to do it:

share|improve this answer

Heroku now has built-in, experimental support for a few geo-location libraries including shapely's dependency GEOS.

You just need to set the following config variable from your command line:

heroku config:set BUILD_WITH_GEO_LIBRARIES=1

You can find out more here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.