Skip to content

Instantly share code, notes, and snippets.

@sgillies
Created January 22, 2015 18:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sgillies/f7bfff349a676cffb1ef to your computer and use it in GitHub Desktop.
Save sgillies/f7bfff349a676cffb1ef to your computer and use it in GitHub Desktop.
Pip installing Rasterio in a Linux Conda environment
# Rasterio is a C extension, need to apt-get gcc and g++.
sudo apt-get update
sudo apt-get install curl gcc g++
# Download miniconda.
curl "http://mapbox-cloudless-testing.s3.amazonaws.com/landsat8/setup/Miniconda-3.7.0-Linux-x86_64.sh" -o "Miniconda-3.7.0-Linux-x86_64.sh"
chmod +x Miniconda-3.7.0-Linux-x86_64.sh
./Miniconda-3.7.0-Linux-x86_64.sh -b
# Put conda on path.
export PATH=/root/miniconda/bin/:$PATH
# Make and activate a new conda env.
# Get GDAL from the PinguCarsti binstar channel.
conda create -n myenv -c PinguCarsti pip gdal gdal-data
source activate myenv
# VERY IMPORTANT to set this environmental variable!
export GDAL_DATA=`gdal-config --datadir`
# Build and install rasterio, linking to the stuff from the conda GDAL package.
GDAL_CONFIG=`which gdal-config` pip install rasterio
# Test.
rio transform --src_crs EPSG:4326 --dst_crs EPSG:3857 "[-105,40]"
# Expected output: [-11688546.533293728, 4865942.279503176]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment