Installing basemap on Mac / Python

pceccon picture pceccon · Feb 17, 2017 · Viewed 23.9k times · Source

I'm having trouble to get the basemap to work in Python in my Mac.

I keep receiving:

    from mpl_toolkits.basemap import basemap
ImportError: No module named basemap

What I did:

brew install gdal
brew install gets
export GEOS_DIR=/usr/local/Cellar/geos/3.4.2/
basemap-1.0.7 $ python setup.py install

I also tried:

basemap-1.0.7 $ cd geos-3.3.3
basemap-1.0.7/geos-3.3.3 $ export GEOS_DIR=~/
basemap-1.0.7/geos-3.3.3 $ ./configure --prefix=$GEOS_DIR
basemap-1.0.7/geos-3.3.3 $ make
basemap-1.0.7/geos-3.3.3 $ make install
basemap-1.0.7/geos-3.3.3 $ cd ..
basemap-1.0.7 $ python setup.py install

None of them worked for me. How can I get this package to work on a MacOS Sierra?

Answer

Alexander Pavlov picture Alexander Pavlov · Nov 6, 2018

On 10.14 Mojave today I did:

brew install geos
pip3 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).