Reputation: 347
I've been having a lot of problems with this install, especially with various unmet dependencies. these are my system infos:
Linux
Python
Upvotes: 8
Views: 22543
Reputation: 347
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:
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
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
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
Upvotes: 15
Reputation: 391
This is an add-on to the previous answer, for those who need to compile the source code of a gdal version :
start with https://gdal.org/development/dev_environment.html then https://gdal.org/development/building_from_source.html
It says that the minimum requirements to build GDAL are:
sudo apt update && sudo apt upgrade && sudo apt install build-essential
PROJ needs the following dependencies :
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
sudo apt-get install libtiff5-dev
sudo apt-get install curl
sudo apt-get install libcurl4-openssl-dev
Download source code of osgeo/PROJ (tar.gz) and build with the same procedure than for GDAL:
tar -xvzf proj-9.2.1.tar.gz proj-9.2.1/
cd proj-9.2.1/
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --build . --target install
Download source code of osgeo/GDAL (tar.gz -> https://github.com/OSGeo/gdal/releases) and build: It is necessary to install libgdal-dev
sudo apt-get -y install libgdal-dev
tar -xvzf gdal-3.7.0.tar.gz
cd gdal-3.7.0/
mkdir build
cd build/
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
Upvotes: 0