matplotlib - Python basemap module impossible to import

ID : 131349

viewed : 6

Tags : pythonmatplotlibimportmatplotlib-basemappython

Top 5 Answer for matplotlib - Python basemap module impossible to import

vote vote

98

I was in the same situation until a minute ago, installing it through this made the trick:

sudo apt-get install libgeos-3.5.0 sudo apt-get install libgeos-dev pip install https://github.com/matplotlib/basemap/archive/master.zip 
vote vote

88

I was facing this issue and I was able to solve it using anaconda

After activating my profile

source activate MyProfileName conda install basemap  from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt # setup Lambert Conformal basemap. # set resolution=None to skip processing of boundary datasets. m = Basemap(width=12000000,height=9000000,projection='lcc',             resolution=None,lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) m.bluemarble() plt.show() 

BlueMarble format of basemap

vote vote

73

I do not use Anaconda, using MacOS, and I have found this solution works for me. I guess it is straight forward, and should work with both Linux and MacOs.

https://stackoverflow.com/a/53171723/2570842

brew install geos pip3 install https://github.com/matplotlib/basemap/archive/master.zip 

For Ubuntu,

sudo apt-get install geos sudo pip3 install https://github.com/matplotlib/basemap/archive/master.zip 
vote vote

67

I had the same issue; trying to access basemap using sys would produce that error. But this worked for me:

import mpl_toolkits mpl_toolkits.__path__.append('/usr/lib/python2.7/dist-packages/mpl_toolkits/') from mpl_toolkits.basemap import Basemap 
vote vote

57

For me, a simple

pip3 install basemap 

did the trick.

Top 3 video Explaining matplotlib - Python basemap module impossible to import

Related QUESTION?