Basemap python. Problem with installation via pip
Hello. I have a problem installing basemap (a package for python that is included in the matplotlib suite for visualizing geodata). I love pip, so I decided to use it. As a result, I get about the same every time I run it. Note that I install this package on python2. 7. The answer to the command:
Sudo pip2 install basemap
Collecting basemap Could not find a version that satisfies the requirement basemap (from versions: ) No matching distribution found for basemap
The search for solutions led to the fact that the official website of basemap has dependencies that pip2, in theory, should resolve itself, but for some reason did not resolve:
- PROJ4 Cartographic Projections Library.
- GEOS
- Pillow
GEOS was installed with a separate command:
Sudo pip2 install geos
All other friends, unfortunately, do not installed.
Direct installation from the repository also for some reason does not cure the situation. Some tips can be found here and here.
2 answers
I found the solution here.
Sudo apt-get install python-matplotlib
Sudo apt-get install python-mpltoolkits.basemap
Note that initially, before installing basemap, the following steps can help:
- Delete matplotlib and install again with the command I specified (not via pip)
- Remove basemap, geos, or any other package from the list above. After that, you should install the basemap, as I indicated.
Can run the test case:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap(projection='ortho', lat_0=50, lon_0=-100, resolution='l', area_thresh=1000.0)
map.drawcoastlines()
plt.show()
Due to the Basemap-bundled substrates, the package was deemed too large to be placed on pypi.org. Link https://pypi.org/simple/basemap/ indicates a file that does not contain links to archives.
There are three ways to install the package
- Install the package from the operating system repository
- Install the package from the Anaconda repository
- Install the package from the source code on GitHub
Basemap source code archives stored on GitHub. The latest version can be found on the page with releases.
You need to install the GEOS library header files. After that, you can call pip by specifying a direct link to GitHub
pip install https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz