[Solved] Install matplotlib / basemap in macOS
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [552 lines of output]
Ignoring numpy: markers 'python_version >= "3.10"' don't match your environment
Ignoring numpy: markers 'python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")' don't match your environment
Ignoring cython: markers 'python_version == "3.2"' don't match your environment
...
...
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> numpy
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: There was an error checking the latest version of pip.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: There was an error checking the latest version of pip.
- brew install matplotplusplus
- brew install numpy
- brew install proj
- brew install geos
- export GEOS_DIR="/usr/local/Cellar/geos/3.10.3/"
- pip3 install cython
- pip3 install numpy
- git clone https://github.com/matplotlib/basemap.git
- cd basemap
- cd packages
- cd basemap
- python3 setup.py install
- cd ..
- cd basemap_data
- python3 setup.py install
- cd ..
- cd basemap_data_hires
- python3 setup.py install
- cd ..
- cp -R basemap_data/ /usr/local/lib/python3.9/site-packages/mpl_toolkits/basemap_data/
This post works through errors installing Basemap, the older Matplotlib toolkit for plotting maps, on macOS, where the pip build often fails on native dependencies such as GEOS.
Because Basemap is deprecated, many users now prefer Cartopy for new map work, but these steps help when an existing project still depends on Basemap.

Comments
Post a Comment