Skip to content

Instantly share code, notes, and snippets.

@sgillies
Last active August 29, 2015 14:06
Show Gist options
  • Save sgillies/434c957448ffeca6f551 to your computer and use it in GitHub Desktop.
Save sgillies/434c957448ffeca6f551 to your computer and use it in GitHub Desktop.
Install Rasterio 0.13.1 on Ubuntu 14.04

I found two problems with installing Rasterio on 14.04

  1. The .c files in Rasterio source distributions (on PyPI) don't compile on 14.04. Generating source for the sdists using Cython 0.20.1 should fix these issue. In the meanwhile, the workaround is to install rasterio from GitHub and use Cython to generate the .c files locally.
  2. Ubuntu 14.04 has no venv for python 3. In a launchpad issue I found that it's a complicated policy issue and there's no fix shipped. The workaround is to create a virtual environment using a python2 virtualenv.

wget the script in this gist, make it executable, and run it to install rasterio and its dependencies on 14.04. After it finishes, type source rasterio/bin/activate to enter the virtual environment with rasterio installed.

Rasterio 0.13.2 will fix #1 above, after which you can just do pip install rasterio==0.13.2.

#!/bin/bash
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install libgdal1h gdal-bin libgdal-dev python3-dev python3-numpy cython3 python3-pip python-virtualenv git
virtualenv --system-site-packages -p python3 rasterio
source rasterio/bin/activate
pip install -r https://raw.githubusercontent.com/mapbox/rasterio/master/requirements.txt
pip install "git+https://github.com/mapbox/rasterio.git@0.13.1#egg=rasterio"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment