Skip to content

Instantly share code, notes, and snippets.

@arthur-e
Last active December 21, 2015 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthur-e/6252129 to your computer and use it in GitHub Desktop.
Save arthur-e/6252129 to your computer and use it in GitHub Desktop.
# Credit goes to my colleague Tyler (http://tylerickson.blogspot.com/2011/09/installing-gdal-in-python-virtual.html)
ENVDIR=/usr/local/pythonenv/
ENVNAME=nasabaer-env
OWNER=arthur
# Install GEOS if necessary
# sudo apt-get libgeos-3.2.2 libgeos-dev
# Install GDAL on the system
cd /usr/local/
sudo mkdir /usr/local/gdal
sudo chown $OWNER /usr/local/gdal && sudo chmod 775 /usr/local/gdal && cd /usr/local/gdal
wget http://download.osgeo.org/gdal/1.10.0/gdal-1.10.0.tar.gz
tar -xzvf gdal-1.10.0.tar.gz && cd gdal-1.10.0
./configure --prefix=/usr/local/gdal/gdal-1.10.0 --with-geos=/usr/bin/geos-config --with-python
make
sudo make install
# Set up a virtual environment
cd $ENVDIR && virtualenv --no-site-packages $ENVNAME
source $ENVDIR$ENVNAME/bin/activate
# Create a symbolic link for the gdal-config
ln -s /usr/local/gdal/gdal-1.10.0/apps/gdal-config $ENVDIR$ENVNAME/bin/gdal-config
# Download the GDAL Python package, setup the build environment, and then install
pip install --no-install gdal
cd $ENVDIR$ENVNAME/build/gdal
python setup.py build_ext --gdal-config=/usr/local/gdal/gdal-1.10.0/apps/gdal-config --library-dirs=/usr/local/gdal/gdal-1.10.0/lib --libraries=gdal --include-dirs=/usr/local/gdal/gdal-1.10.0/include
pip install --no-download gdal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment