Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install GDAL on LINUX Ubuntu 20.04.4LTS for python

I've been having a lot of problems with this install, especially with various unmet dependencies. these are my system infos:

Linux

  • Ubuntu 20.04.4 LTS
  • 64-bit
  • Gnome_Version: 3.36.8

Python

  • using a "poetry environment" (uses pip)
  • python Version: 3.8.10
like image 477
John Lloyd Avatar asked Jun 10 '26 19:06

John Lloyd


1 Answers

I was finally able to install it more or less cleanly and get it working across the board and hope it will be usefull for others:

Installing GDAL on linux is full of problems and issues - this has resolved some of them for me:


sudo apt install libpq-dev 

problem depedency with libpq5

sudo apt install libpq5=12.2-4

sudo apt install libpq-dev 

success!

sudo apt install gdal-bin

sudo apt install libgdal-dev 

problem with LOTS of dependencies

sudo apt install aptitude 

(aptitude can help resolve dependency problems)

sudo aptitude install libgdal-dev 

asks how to resolve issues --> I changed to next reccomendation by pressing "." --> then confirmed by pressing "Y" -->success



after these steps are successfull check if all 3 main libs are installed: "libpq-dev, gdal-bin, libgdal-dev":

apt list --installed | grep "gdal"

result:


WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gdal-bin/focal,now 3.3.2+dfsg-2~focal2 amd64 [installed]
gdal-data/focal,focal,now 3.3.2+dfsg-2~focal2 all [installed,automatic]
libgdal-dev/focal,now 3.3.2+dfsg-2~focal2 amd64 [installed]
libgdal29/focal,now 3.3.2+dfsg-2~focal2 amd64 [installed,automatic]
python3-gdal/focal,now 3.3.2+dfsg-2~focal2 amd64 [installed,automatic]

check gdal version (should be 3.3.2 or higher if all went well):

gdalinfo --version

PYTHON

to install gdal in a python environment should now be possible:

poetry add gdal==3.3.0

or

pip install gdal==3.3.0




by john, this worked 06.07.2022

like image 81
John Lloyd Avatar answered Jun 12 '26 11:06

John Lloyd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!