Python Basemap Import error: "requirement already satisfied"

peter picture peter · Jan 26, 2015 · Viewed 10.4k times · Source

What works is

import mpl_toolkits

What not works is (Import Error basemap not found)

from mpl_toolkits.basemap import Basemap

I followed the instructions here :

http://matplotlib.org/basemap/users/installing.html

Downloaded the lastest basemap*.tar.gz

I run the following commands:

Inside the geos folder

export GEOS_DIR=~/
./configure --prefix=$GEOS_DIR
make
make install

Inside the basemap folder

python setup.py install

Everything runs in sudo mode and no errors. Goes outputs no python binding but not as an error so i am not sure.

It seems not to be properly installed.

Mac Os X 10.10 Yosemite Python 2.7.6

if i type

pip install basemap --allow-external basemap --allow-unverified basemap

Requirement already satisfied (use --upgrade to upgrade): basemap in /Library/Python/2.7/site-packages

so it is there but not importable?

Answer

scottlittle picture scottlittle · Aug 4, 2015

What worked for me was this:

brew install gdal

For completeness, I did these things too:

conda install basemap

But this should be similar to your pip install method above.

Also, for completeness, I added this line to my .bash_profile:

export GEOS_DIR=/usr/local/Cellar/geos/3.4.2/

You may need to edit the version number.

Then, you can run:

from mpl_toolkits.basemap import Basemap