3

I'm trying to install GDAL ina virstualenvwrapper, following several guides and StackOverflow answers.

I'm on ubuntu 13.04 I istalled ligbdal1 and libgdal1-dev

Inside my virtualenv I tried that:

pip install --no-install GDAL

...and after:

python setup.py build_ext --include-dirs=/usr/include/gdal/

but I obtain this errors:

running build_ext
building 'osgeo._gdal' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/gdal/ -I/usr/include/python2.7 -I/home/envs/test/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
extensions/gdal_wrap.cpp: In function ‘int PyProgressProxy(double, const char*, void*)’:
extensions/gdal_wrap.cpp:3237:2: warning: the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
extensions/gdal_wrap.cpp: In function ‘int GDALTransformerInfoShadow_TransformGeolocations(GDALTransformerInfoShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALProgressFunc, void*, char**)’:
extensions/gdal_wrap.cpp:5010:69: error: ‘GDALTransformGeolocations’ was not declared in this scope
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GOA2GetAuthorizationURL(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:5553:79: error: ‘GOA2GetAuthorizationURL’ was not declared in this scope
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GOA2GetRefreshToken(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:5606:94: error: ‘GOA2GetRefreshToken’ was not declared in this scope
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GOA2GetAccessToken(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:5661:93: error: ‘GOA2GetAccessToken’ was not declared in this scope
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_ReadDirRecursive(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:6081:61: error: ‘VSIReadDirRecursive’ was not declared in this scope
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_MajorObject_SetMetadata__SWIG_0(PyObject*, PyObject*)’:
extensions/gdal_wrap.cpp:7501:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
extensions/gdal_wrap.cpp: In function ‘int GDALTransformerInfoShadow_TransformGeolocations(GDALTransformerInfoShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALProgressFunc, void*, char**)’:
extensions/gdal_wrap.cpp:5011:3: warning: control reaches end of non-void function [-Wreturn-type]
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1`

Any suggestions? Where I might be going wrong?

Chris Kempen
  • 9,491
  • 5
  • 40
  • 52

1 Answers1

7

It appears the libgdal1 package on Ubuntu 13.04 is already out of date. The Python cheeseshop (PyPi, which is what pip uses) provides a 1.10.0 wrapper, while the 13.04 package list shows that libgdal version 1.9.0 is provided. Apparently, in 1.10, a number of new functions were introduced, which are the "not declared" errors you're seeing.

Thus, two options:

  • manually install libgdal 1.10. In that case, you can probably use a --with-python option to the configure script and there's no need to install a separate Python binding. You're then also up to date with the latest and greatest, I guess.

  • Download an older Python gdal wrapper from the Python cheeseshop, and continue from there. That's probably the easiest option.

  • I used the second option! More simple ... It works.. Thanks a lot. – Walter Lorenzetti Sep 27 '13 at 16:56
  • 1
    @user566663 you can indicate the answer as 'answered' to help future visitors, so they know there's a working solution (well, at least for you, but probably more people). –  Sep 30 '13 at 08:37
  • Thanks a lot, you put me on the way! Version missmatch of course! For me it was python gdal 1.11.x and with gdal 1.10.x. – Thibault D. Nov 14 '14 at 06:52
  • Note that you can tell PIP to install the version you want as a third option, like explained here: http://stackoverflow.com/questions/5226311/installing-specific-package-versions-with-pip – Thibault D. Nov 14 '14 at 06:53
  • If on ubuntu you then stumble on the missing header issue, that you can solve this way: http://gis.stackexchange.com/questions/28966/python-gdal-package-missing-header-file-when-installing-via-pip – Thibault D. Nov 14 '14 at 06:54