Skip to content

Instantly share code, notes, and snippets.

@slhogle
Last active February 11, 2020 10:18
Show Gist options
  • Select an option

  • Save slhogle/962d2afd6e773863b16d2e5e8fd993fe to your computer and use it in GitHub Desktop.

Select an option

Save slhogle/962d2afd6e773863b16d2e5e8fd993fe to your computer and use it in GitHub Desktop.
Installing cartopy macOSX 10.13.6

Introduction

It was a pain to install cartopy on macOS. Here is what I did. It works as of Feb 10 2020. Uses proj, geos, and gdal from homebrew. none of that conda crap. Inspiration from here

Install your geo dependencies via homebrew

brew install proj  # version 6.3.0
brew install geos  # version 3.8.0
brew install gdal  # version 2.4.4

Install Cython v0.29.15

nice clean Cython install

python -m pip install cython

Install shapely v1.7.0

We need to do this first so it finds the right shapely, I think??

Install without the binary [otherwise Bus error](SciTools/cartopy#1274

python -m pip install --no-binary :all: shapely

Install GDAL 2.4.4

Need to force pip to install the same gdal version as homebrew installed. See here

python -m pip install GDAL==`gdalinfo --version | sed s/,// | awk '{print $2}'`

Install pykdtree

Must deal with clang which is system default compiler on macOS

export USE_OMP=0 && python -m pip install git+https://github.com/storpipfugl/pykdtree.git

Finish installing dependencies

pip install matplotlib Pillow pyepsg scipy OWSLib fiona pyproj numpy pyshp six

Install cartopy c0.17.1.dev244-

I needed to install the dev244 version because of some issues using versions of proj v6.0.0 and above. Presumably will be fixed in next official version release. See here.

export CFLAGS="-I/usr/local/include" && export LDFLAGS="-L/usr/local/lib" && python -m pip install git+https://github.com/SciTools/cartopy.git --no-binary cartopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment