'Gettingerror: legacy-install-failure, while installing basemap
I am trying to install Basemap using pip, however at some point it reaches the error:
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.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
I do not really know what to do here, and I could not find anyone who encountered the same error. I have tried upgrading pip and setuptools, but they did not seem to help. What should I do?
P.S. I have been trying to install basemap for the past 4 days and I was not very sucessfull. If you know how to install it on MacOS, please hit me up! Thank you!
Solution 1:[1]
For Windows:
To install basemap you need to download the wheel file from this path:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#basemap
for python 3.10 this will be the file:
basemap?1.3.2?cp310?cp310?win_amd64.whl
Then you have to go to the folder where the above mentioned .whl file is saved and run this command from there:
pip install basemap?1.3.2?cp310?cp310?win_amd64.whl
For Mac OS please refer:
https://github.com/matplotlib/basemap/releases:
Make sure you have:
brew install geos
brew install matplotlib
brew install numpy
brew install proj
Add export GEOS_DIR="/user/local/Cellar/geos/3.10.2/" to your .bash profile and reload it via:
source ~/.bash_profile
git clone --depth 1 https://github.com/matplotlib/basemap.git
then in the basemap/packages/basemap directory
pip3 install
For Google Colab:
!sudo apt-get install libgeos-3.6.2
!sudo apt-get install libgeos-dev
!pip install git+https://github.com/matplotlib/basemap#subdirectory=packages/basemap
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Talha Tayyab |
