I am a Python Noob. (Using Mac OS 10.12 & Python 3.7) I'm trying to use mpl_toolkits.basemap
to execute the code
from mpl_toolkits.basemap import Basemap
I googled the way to get matplotlib and successfully installed it. However, while it's possible to run "from mpl_toolkits.basemap import Basemap" in terminal on mac,
it fails to be loaded if I run the command within IDLE.
Then, I googled to figure out the issue and got the hint that it could be resolved if I install Basemap properly.
To install Basemap, I think I need to go with "FINK".
However, Fink is only available up to 10.5 OS while mine is 10.12. And FINK website says do not update OS before upgrading FINK. However, it's too late for me. Cause I updated my OS longtime ago and recently I started to learn Python Using Mac.
So I guess, if there is a way to install Basemap not using apt-get, (the codes below is from "Python basemap module impossible to import")
sudo apt-get install libgeos-3.5.0
sudo apt-get install libgeos-dev
sudo pip install https://github.com/matplotlib/basemap/archive/master.zip
I think my issue could be cleared. Since I'm really really noob, I'm not sure this is the reason for my failing in "from mpl_toolkits.basemap import Basemap".
What I tried so far is
1) brew install basemap
with the error of
Error: No available formula with the name "basemap" ==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run: git -C "$(brew --repo homebrew/core)" fetch --unshallow
2) pip install basemap
with the error of
Requirement already satisfied
3) sudo pip install https://github.com/matplotlib/basemap/archive/master.zip
with the error of
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-lux494o4/pyproj/
4) conda install basemap
with the following message of
All requested packages already installed.
5) conda install -c conda-forge basemap
with the following message
Preparing transaction: done Verifying transaction: done Executing transaction: done
Can anyone help to install basemap properly so that I could run
"from mpl_toolkits.basemap import Basemap"
in my IDLe? My IDLE Sheel keeps saying
Traceback (most recent call last): File "", line 1, in from mpl_toolkits.basemap import Basemap ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
while my terminal doesn't have problem with running the code.
Appreciate it in advance.
Ran into this myself today my solution:
brew install geos
pip3 install -q https://github.com/matplotlib/basemap/archive/master.zip
This also may help: missing libgeos_c.so on OSX