3

I would like to install GDAL==2.0.1 on Ubuntu. A lot of possibilities are found on SO, but none did work for me. I'll give an overview of a selection of my attempts:

1. Using pip directly

pip install gdal==2.0.1

returns:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-xob38erk/gdal/

Note: ez_setup and setup_tools are installed

2. easy_install

easy_install GDAL==2.0.1

returns:

setuptools.sandbox.UnpickleableException:

gdal_config_error(FileNotFoundError(2, "No such file or directory: 'gdal-config'"),)

3. Build from source

Set variables

sudo apt-get install build-essential python-all-dev
export BASE=~
export GDALVERSION='2.0.1'

derive a few others

export GDALFILE="gdal-${GDALVERSION}.tar.gz "
export GDALURL="http://download.osgeo.org/gdal/${GDALVERSION}/${GDALFILE}"
export GDALDIR="$BASE/gdal-${GDALVERSION}"

Download, install and compile for Python

cd $BASE
wget $GDALURL
tar -xvzf $GDALFILE
cd $GDALDIR
./configure --with-python
make
sudo make install

I get the same error as described by Jeremy G.

4. install Python-Gdal

sudo apt-get install gdal-bin python-gdal

This runs with success, but no package gdal is known (with import gdal in python shell or pip freeze).

  • 1
    As I know the gdal 2 are only available from ubuntugis-unstable ppa (launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable) and nextgis ppa (launchpad.net/~nextgis/+archive/ubuntu/ppa/+packages). There are you get it? – Dmitry Baryshnikov Sep 8 '16 at 14:28
  • This instruction based on ubuntugis stable. GDAL 1.11.2 is only there. Instead sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update you have to execute sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable && sudo apt-get update to get GDAL 2 – Dmitry Baryshnikov Sep 8 '16 at 14:38
  • This runs successfully, thanks. But still I do not have gdal as a package – API Sep 8 '16 at 14:40
  • How do you check it? I usually do: from osgeo import gdal and than print gdal.__version__. Also check ls /usr/lib/python2.7/dist-packages/osgeo/ or ls /usr/lib/python3/dist-packages/osgeo/ - they should exists – Dmitry Baryshnikov Sep 8 '16 at 14:47
  • just like that, or with pip freeze in ubuntu shell – API Sep 8 '16 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.