33

apt-get install python-gdal installs version 1.6.0 and this is already installed. I would like to install the 1.9.0 version.

Do I have to de-install 1.6.0 first and then compile manually or is there an apt-get package that I have missed?

Taras
  • 32,823
  • 4
  • 66
  • 137
Robert Buckley
  • 10,175
  • 14
  • 76
  • 156

5 Answers5

61

Note: this is an answer for an older version of GDAL, and there are newer versions available (including current) that can be compiled similar to this answer. Just replace the version numbers in the commands below.


Build from source, with Python bindings:

sudo apt-get install build-essential python-all-dev
wget http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz
tar xvfz gdal-2.0.0.tar.gz
cd gdal-2.0.0
./configure --with-python
make
sudo make install

In addition, some Linux distributions require the shared library cache to be updated after install:

sudo ldconfig
Mike T
  • 42,095
  • 10
  • 126
  • 187
  • 2
    Thanks Mike is was very helpful, your description how on to build up gdal from the source. –  Aug 08 '12 at 21:32
  • @Rengifo Please upvote useful answers. You may leave comments but upvoting is even more important. – underdark Aug 09 '12 at 06:24
  • After 2 days unable to get gdal functioning in Ubuntu, finding this comment was /very/ helpful! One minor note though is that the rest of the GIS stack installs into /usr/local/bin and this seems to install into /usr/bin/ – Mittenchops Jan 08 '13 at 07:14
  • I had trouble installing from the repository. This took awhile to execute but it worked. – RevNoah Jun 14 '13 at 22:15
  • For what it is worth, this was one of the quickest/easiest install-from-source packages I've had dealt with in a while. Recommend going this route! – Yablargo Nov 08 '13 at 21:40
  • 2
    For future users: the folder structure changed a little bit. In order to download the latest stable version, the wget command would look as follows: wget http://download.osgeo.org/gdal/1.11.1/gdal-1.11.1.tar.gz. – fdetsch Jan 12 '15 at 09:53
  • 1
    It's better to use checkinfo instead of make install, in case you ever wanted to uninstall it. Simple make uninstall didn't work for GDAL installed this way. – Pavel V. Aug 07 '15 at 06:55
  • What is required after these steps to use gdal from python? I get a module not found when trying to import assuming I need to make python aware of it – Poul K. Sørensen Mar 20 '16 at 17:29
  • @pksorensen ask in a different question with your details, since the above steps should install it for Python – Mike T Mar 20 '16 at 20:11
  • thanks. The confirmation was enough for me to solve my problem. – Poul K. Sørensen Mar 20 '16 at 20:43
  • I get: make: *** No rule to make target "config.status", needed by "GDALmake.opt". Stop.. I have make installed – Joost Döbken Sep 08 '16 at 12:25
  • This worked perfect for Gdal 2.4 as well – Robin Dec 22 '18 at 10:58
10

You can get 1.9 from Ubuntugis (see https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable).

See http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries for other sources of binaries.

Failing all else you can build 1.9 from the sources (http://trac.osgeo.org/gdal/wiki/BuildHints)

Ian Turton
  • 81,417
  • 6
  • 84
  • 185
8

In case the question asked was still relevant, I managed to install Python-Gdal on Ubuntu 14.04 (Trusty) simply using:

apt-get install python-gdal

Hakim
  • 956
  • 12
  • 33
  • 2
    Your answer just made my day. I had been going by Mike's still good answer but I encountered some crazy error when installing on the third machine. But when running this it went smoothly. Thanks a lot! – john-jones Nov 07 '16 at 20:22
5

You can get 1.9 from Ubuntugis (see https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable) as you're running Ubuntu 10.04 Lucid. 1.9 was built for Lucid for the OSGEO Live DVD and should be available for other Ubuntu versions soon (ish). Source: some email traffic on the UbuntuGIS mailing list.

user2856
  • 65,736
  • 6
  • 115
  • 196
0

In my case, I had to use with my Ubuntu:

 sudo apt-get install gdal-bin