Home:ALL Converter>Python GDAL does not install on Mac OSX El Capitan

Python GDAL does not install on Mac OSX El Capitan

Ask Time:2016-06-08T18:53:09         Author:Salias

Json Formatter

I am having several issues when installing pygdal in my Mac OSX El capitan. The procedure is the folowing:

  1. Install GDAL Libraries from http://www.kyngchaos.com/software/frameworks#gdal_complete
  2. pip install gdal

The output is the following:

.
.
.
    extensions/gdal_wrap.cpp:3085:10: fatal error: 'cpl_port.h' file not found

    #include "cpl_port.h"
         ^
2 warnings and 1 error generated.
error: command 'cc' failed with exit status 1

Looks like the installer cannot find the GDAL libraries, or headers (libgdal or gdal-devel in ubuntu).

Where are they placed in OSX?

FYI, the following /Library/Frameworks/GDAL.framework/Programs is into the $PATH variable.

Author:Salias,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37700484/python-gdal-does-not-install-on-mac-osx-el-capitan
Salias :

I finally (with a little help from Cam_Aust) solved the problem !!! \n\nHere is what I did:\n\n\nFind the cp_port.h file in your system: sudo find / -name cpl_port.h, My output was:\n\n\n/Library/Frameworks/GDAL.framework/Versions/1.11/Headers/cpl_port.h /opt/local/include/cpl_port.h\n\n\nAdd the resulting folders to your $PATH in your bash init script (~/.bash_login or ~/.zshrc). This worked for me: export PATH=/Library/Frameworks/GDAL.framework/Headers:$PATH\nOpen a new terminal session or source ~/.zshrc\n\n\nAfter this, you can now pip install gdal:\n\nCollecting gdal \nUsing cached GDAL-2.1.0.tar.gz\nInstalling collected packages: gdal\nRunning setup.py install for gdal ... done\nSuccessfully installed gdal-2.1.0\n",
2016-06-08T15:39:16
yy