Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 4 down vote accepted

Haven't tried, but found a tweet that looks promising https://mobile.twitter.com/JCSanford/status/281540051203141632

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
1  
Great thanks! I'll try it out and post back tomorrow. –  John Steedman May 29 '13 at 19:40
add comment

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

Shapely==1.2.17
Flask==0.8
Jinja2==2.6
Werkzeug==0.8.3
certifi==0.0.8
chardet==1.0.1
distribute==0.6.24
gunicorn==0.14.2
requests==0.11.

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 libgeos.so. 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. libgeos-3.2.2.so 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/libgeos-3.3.3.so . 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
show 2 more comments

Your Answer

 
discard

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.