Skip to content

Instantly share code, notes, and snippets.

@mtaziz
Forked from cspanring/pip-install-gdal.md
Created July 21, 2018 05:41
Show Gist options
  • Save mtaziz/edab7bf3b88af5accc89a59600569282 to your computer and use it in GitHub Desktop.
Save mtaziz/edab7bf3b88af5accc89a59600569282 to your computer and use it in GitHub Desktop.
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment:

$ virtualenv gdalenv
$ source gdal/bin/activate

Download GDAL:

(gdalenv) $ pip install --no-install GDAL

Specify where the headers are:

(gdalenv) $ cd /path/to/gdalenv/build/GDAL
(gdalenv) $ python setup.py build_ext --include-dirs=/usr/include/gdal/

Install GDAL:

(gdalenv) $ pip install --no-download GDAL

Done.


Source: http://gis.stackexchange.com/questions/28966/python-gdal-package-missing-header-file-when-installing-via-pip

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