matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
771 stars 392 forks source link

Although in Sitepackages, not importable #186

Open Stophface opened 9 years ago

Stophface commented 9 years ago

I installed basemap the following:

Download the source from here:

http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/

Follow the instructions:

cd geos-3.3.3
export GEOS_DIR=/usr/local
./configure --prefix=$GEOS_DIR
make; make install

Then I went on the PROJ4 website http://trac.osgeo.org/proj/ Downloaded vers 4.9.1

./configure
make
make install

Then back into the basemap folder:

sudo python setup.py install

No error messages during that process. However,

from mpl_toolkits.basemap import Basemap yields
"No module named basemap"

I checked my python 2.7 folder under

 /Library/Python/2.7

There is folder "mpl_toolkits" which contains a folder basemap. Why is it not importing?

herovit commented 9 years ago

I had a very similar problem on an Amazon EC2 instance running Linux. Checked the path, checked everything, finally for a new error that was something like the comment from Elias here: http://askubuntu.com/questions/555474/problem-importing-a-module-mpl-toolkits-basemap-in-python

After a lot of digging, it appears that in my case, for some reason the install script put the basemap folder in a new mpl_toolkits folder in dist-packages instead of the existing mpl_toolkits folder in site-packages and this new mpl_toolkits folder had an init.py in it. Nothing worked.

I moved the basemap folder over to the existing site-packages/mpl_toolkits folder and it seems to work. I hope that extra info helps.