Skip to content

Instantly share code, notes, and snippets.

@chewwt
Created August 27, 2020 11:23
Show Gist options
  • Save chewwt/f48619852990a0dad0edd0c9b1c53343 to your computer and use it in GitHub Desktop.
Save chewwt/f48619852990a0dad0edd0c9b1c53343 to your computer and use it in GitHub Desktop.
gdal for ubuntu 20.04 with python virtual env

Installing GDAL for Ubuntu 20.04

No need to add ppa anymore

sudo apt install gdal-bin libgdal-dev
workon <env>
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
@GrayCygnus
Copy link

I can confirm this worked for my Ubuntu 20.04 Server. Thanks a Lot.

I also needed to apt install python3-dev and also apt install g++, because without them the installation complained (no Python.h header, and 'cc1plus': execvp: No such file or directory, respectively).

Link to the respective SO posts that shed light on my situation:

@Lusimba
Copy link

Lusimba commented Jun 27, 2023

In case anyone's working on a dockerised application, here is an image you can use
lusimba/gdal-gis-intermediary:latest

It is built with Python3.8 and has Postgres binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment