Installing basemap on Mac / Python
On 10.14 Mojave today I did:
brew install geospip3 install https://github.com/matplotlib/basemap/archive/master.zip
and it seems to work (mine is Python 3.6 from https://python.org with matplotlib installed by pip).
Did you ever manage to get it working?
I was able to install Basemap fine on Sierra (also using Homebrew for its dependencies), following the instructions here: http://matplotlib.org/basemap/users/installing.html
A couple notes, just to make sure nothing is being overlooked:
- In your notes, you listed
brew install gets
, though I assume it was a typo and you actually meant & usedbrew install geos
when installing. - Are you certain the correct version of geos was used when modifying your .bash_profile? Some of the examples I've seen around the web use a specific version, so there's always a chance for a copy/paste error. As of yesterday, the version I wound up using was 3.5.0, so my path looked like this:
export GEOS_DIR=/usr/local/Cellar/geos/3.5.0/
. The version can be verified by looking in your /usr/local/Cellar/geos/ directory to see which one is installed. - I'm not 100% certain this matters, but did you reload your .bash_profile after modifying it?
source ~/.bash_profile
.
This is a full list of what I did:
brew install matplotlibbrew install numpybrew install geosbrew install proj
Downloaded Basemap 1.0.7 source tar file (https://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/), untarred it.
Added export GEOS_DIR=/usr/local/Cellar/geos/3.5.0/
to a new line in my .bash_profile, and then reloaded it via:
source ~/.bash_profile
From within untarred Basemap directory:
python setup.py install
Imported Basemap in a python script (via a tutorial elsewhere) with import mpl_toolkits.basemap as bm
, and was able to confirm it worked with a produced map.
After trying for a long time I managed to make basemap-1.1.0 install on High Sierra. Dependency versioning was important.
I installed Python 3.6 with homebrew.Next I created a venv.I then used pip to install matplotlibpip install matplotlib==2.2
(3+ wouldn't work).
I then followed the instructions here:
https://www.fsanmartin.co/mac-install-matplotlib-basemap-on-virtualenv/
And it finally worked!
Big thank you to the kind person who wrote those instructions.