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 am trying to setup an isolated python virtualenv to work on GIS projects on my Mac OS X. Sounds like I will need to install the GEOS, PROJ, GDAL/OGR from the kyngchaos site here and not easy_install it into my virtualenv. Is that accurate?

The downloads available on kyngchaos are pkg installers and not just an egg or bdist of python modules. So, I am not very sure as to what else the installer is doing to the environment other than just copying files to /Library/Framework/geos.framework folder.

How would I go about installing a specific version of GEOS, PROJ, GDAL/OGR into my new python virtualenv? I would appreciate your help/suggestions on this issue.

Thank You, Vish

share|improve this question
up vote 4 down vote accepted

If each Framework of Kyngchaos is in the PATH, it is easy. Every framework has a Unix folder, with the libraries for compiling things like pyproj or geos python wherever you want, even in a private Python environment (I've never had a problem)

The only problem is that Gdal python is in the Gdal Framework. But in site-packages there a file gdal.pth

gdal.pth file:

import sys; sys.path.insert(0,'/Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages')

if you do not want to compile it yourself, copy this file in your isolated python virtualenv

share|improve this answer
having installed those projects by hand, through 3rd party installers (fink/macports/whatever) and through other means I will guarantee to you that the best way is through Kynchaos! +1000 – Ragi Yaser Burhum Feb 24 '12 at 1:39

I make replicable Python/C/C++ GIS environments using virtualenv and zc.buildout. My ichpage project is a little dated but could serve as a template for an up-to-date one (like the one I use for my Pleiades site development work and deployments). Blog post about it at

share|improve this answer

Virtualenv allows you to provision a private Python environment, but does not extend to system libraries outside of the Python universe. The three packages you mentioned are all C/C++ applications at their core, so while they have interfaces for use with Python, they cannot be packaged without interacting with the C libraries (libc on up).

Because of the difficulty installing those packages from scratch, particularly on OS X, you may want to think about running a sandboxed virtual machine using something like VirtualBox and install the packages through apt on that sandboxed machine: while it is possible to do the same on OS X, it probably isn't worth the effort.

share|improve this answer
This is a good recommendation. I followed this approach using Fusion, not VirtualBox, but I might try Virtual Box next time. I used CentOS for the OS in the box. (Not the best OS choice due to the stable nature and older versions of Python, etc.) – DavidF Feb 22 '11 at 16:55

If you need to use OSX you can easily avoid installation complexities by installing homebrew!

After this the only commands you will need to enter are:

brew install gdal

It will automatically install also proj and geos because they are gdal dependencies.

share|improve this answer
I don't believe this addresses the issue of accessing gdal from within a virtualenv (I tried it and it did not work) – djq Oct 11 '14 at 15:37

I found a good blog post that provides another solution that worked in my case:

The only difference to the blog post is that I had to do is to download the correct version of GDAL that matched the kyngchaos packages. In my case I was using the GDAL framework version 1.10, so the following install was successful

source venv/bin/activate
pip install --no-install GDAL==1.10.0
cd venv/build/GDAL
python build_ext\

Then leave the GDAL directory and install without download

cd ~
pip install --no-download GDAL

UPDATE: You might have to add some env vars before calling for the compilation step to work (see this question)

export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments
share|improve this answer

Yellowcap's answer above worked for me with some minor tweaks:

pip install --no-install is no longer an option. Instead, inside the env directory:

pip download GDAL==1.11.2 (or whichever version you want)

Unzip the downloaded directory and cd into it:

tar -zxvf GDAL-1.11.2.tar.gz
cd GDAL-1.11.2

pip install --no-download is also no longer an option. Instead stay in the GDAL directory and run:

python build
python install
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.