Python GDAL package missing header file when installing via pip
As suggested in the other thread, exporting some shell variables before running pip worked flawlessly. A path for *_INCLUDE_PATH
can be found with gdal-config --cflags
.
# GDAL library must have been installedsudo apt-get install libgdal-dev# Set up pip and/or virtualenv stuff...# Now install Python binding for GDALexport CPLUS_INCLUDE_PATH=/usr/include/gdalexport C_INCLUDE_PATH=/usr/include/gdalpip install GDAL
Tomyun's answer worked for me, with the proviso that you have to ensure that the version of GDAL-dev installed via apt-get
matches the version being installed by pip
.
For Ubuntu 14.04, the commands are:
# GDAL library must have been installedsudo apt-get install libgdal-dev# Set up pip and/or virtualenv stuff...# Now install Python binding for GDALexport CPLUS_INCLUDE_PATH=/usr/include/gdalexport C_INCLUDE_PATH=/usr/include/gdalpip3 install GDAL=1.10.0
Using PIP :
pip install --no-install GDAL
Then cd into ENV/build/GDAL
python setup.py build_ext --include-dirs=/usr/include/gdalpip install --no-download GDAL
(Source: http://ubuntuforums.org/showthread.php?t=1769445)
Using Buildout :
[gdal-bindings]recipe = zc.recipe.egg:customegg = GDAL==1.9.1include-dirs = /usr/include/gdallibrary-dirs = /usr/lib