basemap ImportError: No module named 'mpl_toolkits.basemap'
Asked Answered
L

3

6
from mpl_toolkits.basemap import Basemap  

gives

ImportError: No module named 'mpl_toolkits.basemap'  

I installed basemap with conda

wayne@dors:~$ conda install basemap
Solving environment: done

# All requested packages already installed.  

I am running ubuntu 15.04, Python3.4, matplotlib 2.1.1, numpy 1.8.2
How do I fix?

Lodgings answered 22/1, 2018 at 18:39 Comment(3)
I find Home/matplotlib/lib/mpl_toolkits but there is no module named basemap.Lodgings
Home/matplotlib/lib/mpl_toolkits is an unusual place for the fike to be - I'd expect .../site-packages/mpl_toolkits/basemap.pth or similarRosner
@WayneAngel did you ever find a solution?Indira
S
10

Try to install it with this command:

conda install -c conda-forge basemap

"Only the 'crude' and 'low', resolution datasets are installed by default" .You may need to install the following for high resolution:

conda install -c conda-forge basemap-data-hires
Seltzer answered 7/6, 2018 at 21:16 Comment(0)
B
0

I think you need to install from source, not via conda, as per the docs :

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

Bonni answered 22/1, 2018 at 19:0 Comment(1)
OK. I tried installing from source per above. The install appeared to go OK. I still get the same error. I did notice that the "python setup.py install" wrote to "/home/wayne/anaconda3/lib/python3.6/site-packages/basemap-1.1.0-py3.6.egg-info." This seems odd to me but, since I have a $PATH to this I expect it to be OK.Lodgings
A
0

try install basemap from source

pip install https://github.com/matplotlib/basemap/archive/master.zip
Ahlgren answered 30/8, 2020 at 22:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.