3

I tried to install python GDAL via pip but getting the following error:

extensions/gdal_wrap.cpp:4265:47: error: use of undeclared identifier 'GDALDatasetCreateLayer'; did you mean 'GDALDatasetShadow_CreateLayer'? OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetCreateLayer( self, GDALDatasetShadow_CreateLayer

I guessed the reason is the mismatched version of GDAL library, so tried this:

$ brew unlink gdal
$ brew install gdal
$ gdalinfo --version
GDAL 1.11.1, released 2014/09/24

But, still getting the error.

Do I need to install an older version of python GDAL? If so, please let me know which version.

Thanks.

2
  • 1
    Pip and GDAL are notorious for failing to work together. Have you tried the OsX GDAL port by Kyngchaos?
    – Kersten
    Jun 29, 2015 at 19:56
  • Nor have you made clear which gdalinfo you are running nor what its library dependencies are. Try otool -L $(which gdalinfo) as well as just which gdalinfo to be sure. If you tried installing via pip, did you use the system's python / pip or did you use brew's? Are you perhaps still using the former? Are you using a virtualenv for any of this?
    – jwd630
    Jul 6, 2015 at 18:14

1 Answer 1

10

As of today, brew has

gdalinfo --version GDAL 1.11.2, released 2015/02/10

Thus, pip install GDAL==1.11.2

Goes just fine. Pypi has 2.0.0 available

1
  • I found that you do not need the exact same version (it failed to install too), but the same major version.
    – konrad
    Jan 17, 2020 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.