Search code examples
pythongdalubuntu-22.04gdal2tiles.py

Update gdal on ubuntu 22.04


I'm trying to update GDAL on my Ubuntu 22.04 :

python3 -m pip install --upgrade GDAL

This error occurs :

extensions/gdal_array_wrap.cpp:3237:10: fatal error: ogr_recordbatch.h: Aucun fichier ou dossier de ce type
       3237 | #include "ogr_recordbatch.h"
            |          ^~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

"Aucun fichier ou dossier de ce type" means no file or folder found in french.

OGR is installed and is working fine :

ogrinfo --version
GDAL 3.4.1, released 2021/12/27

I am out of idea ...


Solution

  • ogr_recordbatch.h is one of the new include files in GDAL 3.6.0 - https://github.com/OSGeo/gdal/blob/v3.6.0/NEWS.md

    Obviously your system-installed GDAL from Ubuntu is an older version - 3.4.1.

    I don't know what are you trying to do.

    If you are trying to update only the Python module, it requires having an adequate system-installed GDAL. This can't work.

    If you are trying to update the system-installed GDAL - Ubuntu does not have a current GDAL PPA.

    You have two options if you need a current version:

    • Get one of the official Docker images and use it in Docker
    • Uninstall the Ubuntu system-install GDAL, get the source code and compile it yourself