Moreover, you have created a virtualenv and installed the Python dependencies (Cython, NumPy):
Yet, when you finally go install Cartopy, you still encounter the following seemingly inexplicable error:
(cartopy_venv)$ pip install cartopy [...] clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include -I./lib/cartopy -I-I/usr/local/Cellar/proj/4.9.2/include -I/usr/local/Cellar/geos/3.5.0/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lib/cartopy/trace.cpp -o build/temp.macosx-10.11-x86_64-2.7/lib/cartopy/trace.o lib/cartopy/trace.cpp:249:10: fatal error: 'proj_api.h' file not found #include "proj_api.h" ^ 1 error generated. error: command 'clang' failed with exit status 1 ----------------------------------------
despite the fact that proj_api.h does in fact exist:
It turns out this is a bug in the setup.py script for Cartopy that prepends an extraneous -I to the include directory containing proj_api.h (in the error message above one can see that the call to clang has -I-I/usr/local/Cellar/proj/4.9.2/include as one of its flags) so clang ends up not being able to see it at all.
I discuss this bug at some length and provide a fix in my pull request, which has since been merged and should be included in the Cartopy 0.14.0 release.
Until the next release, the temporary workaround is to use the bleeding-edge version (not recommended):
(cartopy_venv)$ pip install git+https://github.com/SciTools/cartopy.git@master#egg=cartopy Collecting cartopy from git+https://github.com/SciTools/cartopy.git@master#egg=cartopy [...] Installing collected packages: cartopy Running setup.py install for cartopy ... done Successfully installed cartopy-0.14.0
Or alternatively, pass the build_ext subcommand and its options to setup.py via the --global-option flag in pip (highly recommended):
(cartopy_venv)$ pip install --global-option=build_ext --global-option=$(pkg-config --cflags proj) cartopy [...] Installing collected packages: cartopy Running setup.py install for cartopy ... done Successfully installed cartopy-0.13.0
And that's pretty much it :)