When running my Python program, the following error came out:
ERROR 1: NUMPY driver was compiled against GDAL 2.1, but the current library version is 2.2
What can I do to fix this?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
From the GDAL Python gotchas:
Python crashes in GDAL functions when you upgrade or downgrade numpy
Much of GDAL's Python bindings are implemented in C++. Much of the core of numpy is implemented in C. The C++ part of GDAL's Python bindings interacts with the C part of numpy through numpy's ABI (application binary interface). This requires GDAL's Python bindings to be compiled using numpy header files that define numpy C data structures. Those data structures sometimes change between numpy versions. When this happens, the new version of numpy is not be compatible at the binary level with the old version, and the GDAL Python bindings must be recompiled before they will work with the new verison of numpy. And when they are recompiled, they probably won't work with the old version.
If you obtain a precompiled version of GDAL's Python bindings, such as the Windows packages from http://vbkto.dyndns.org/sdk/, be sure you look up what version of numpy was used to compile them, and install that version of numpy on your machine.
So you either need to downgrade gdal to 2.1 or recompile the gdal python bindings against the new numpy headers.
In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev, and python wrapper via python-gdal
sudo apt-get install libgdal-dev sudo apt-get install python3-gdal
sudo apt-get install python-gdal
this works for me fine