Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Basemap Import error: "requirement already satisfied" [duplicate]

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?

like image 385
peter Avatar asked Jan 26 '15 19:01

peter


2 Answers

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
like image 164
scottlittle Avatar answered Nov 15 '22 23:11

scottlittle


The easiest way to install basemap on OS X is to use Ports.

Just type in the below command and the see the magic unfold:

port install  py-matplotlib-basemap
like image 37
Linus_30 Avatar answered Nov 15 '22 23:11

Linus_30