Python gdal import error

Python gdal import error

I installed gdal from source using steps from this answer /a/21739/60378 (ommiting first line sudo apt-get install build-essential python-all-dev as it did not work for me). Everything went without errors. When i try to import osego or gdal it gives me error: undefined symbol: GDALSetRasterUnitType

>>> import gdal Traceback (most recent call last): File "", line 1, in  File "/usr/lib64/python2.7/site-packages/GDAL-1.9.0-py2.7-linux-x86_64.egg/", line 2, in  from osgeo.gdal import deprecation_warn File "/usr/lib64/python2.7/site-packages/GDAL-1.9.0-py2.7-linux-x86_64.egg/osgeo/", line 21, in  _gdal = swig_import_helper() File "/usr/lib64/python2.7/site-packages/GDAL-1.9.0-py2.7-linux-x86_64.egg/osgeo/", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) ImportError: /usr/lib64/python2.7/site-packages/GDAL-1.9.0-py2.7-linux-x86_64.egg/osgeo/ undefined symbol: GDALSetRasterUnitType

Server is using fedora core 14, which I cannot upgrade right now. What could be wrong? Is there any simpler gdal installation method?

I had similar problem and I solved this problem by downgrading of GDAL. I had GDAL 2.2.3 and I downgrade it to version GDAL 2.1.0.

You can install it with:

pip install GDAL==2.1.0

or only for user:

pip install --user GDAL==2.1.0

Watch the video: Convert between CSV and GeoTIFF with GDAL in Python