Python basemap module impossible to import

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

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


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