Search code examples
pythonpipgdal

Error while installing GDAL


I'm trying to install GDAL through pip. But I'm getting this error:

extensions/gdal_wrap.cpp:3089:27: fatal error: cpl_vsi_error.h: No such     file or directory
 #include "cpl_vsi_error.h"
                           ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I used these commands:

sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip install GDAL

Can anyone tell me how to install it ?


Solution

  • Check that you installed GDAL using this command

    gdal-config --version
    

    Then run this commands:

    pip download="some_path" GDAL
    cd some_path
    tar -xvzf GDAL-<version>.tar.gz
    cd GDAL-<version>
    python setup.py build_ext --include-dirs=/usr/include/gdal/
    python setup.py install