Registry / data / basemap

basemap

JSON →
library2.0.0pypypi✓ verified 85d ago

Basemap is a deprecated Python library for plotting 2D data on map projections with Matplotlib. While it enabled various map projections, coastlines, and geopolitical boundaries, it is no longer actively developed and is officially superseded by Cartopy. The current version is 2.0.0.

pip install basemap
INSTALL
IMPORT
SIG · BASEMAP
B
basemap
datapythonv2.0.0
Install
8.7s avg
Import
2996ms
Disk
251MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 8.7s · import 2.996s · 246MB
251MB installed
● package 251MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Basemap
from mpl_toolkits.basemap import Basemap

This quickstart demonstrates how to initialize a Basemap instance with a 'mill' (Miller cylindrical) projection, draw basic map features like coastlines and meridians, and save the output to a file. Remember that Basemap is deprecated.

import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap # Create a new figure fig = plt.figure(figsize=(8, 6)) # Create a Basemap instance for a global cylindrical projection m = Basemap(projection='mill', llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180, resolution='l') # Draw coastlines, countries, parallels, and meridians m.drawcoastlines() m.drawcountries() m.drawparallels(range(-90, 91, 30)) m.drawmeridians(range(-180, 181, 60)) plt.title("Simple Basemap Example (Deprecated)") # Save the plot instead of showing it for script execution plt.savefig("basemap_example.png") print("Basemap example plot saved to basemap_example.png")
Debug
Known issues
breakingBasemap is officially deprecated. For new projects, use Cartopy (or other modern geospatial libraries) instead. It is no longer actively maintained or developed, and support may cease completely.
fix
Migrate new code to `cartopy` or `geopandas`. For existing projects, consider a migration strategy.
affects: All versions, officially stated in the 2.0.0 release notes and GitHub README.
breakingBasemap 2.0.0 requires PROJ 6+ and GEOS as system-level dependencies. PROJ 6 introduced a new API, which required significant changes in Basemap and frequently causes installation or runtime failures if these libraries are not present or correctly configured.
fix
Ensure PROJ 6+ (e.g., `libproj.so.19` or `proj.dll` for PROJ 9+) and GEOS are installed on your system. Using `conda install -c conda-forge basemap` is often the most reliable way as it handles these dependencies.
affects: 2.0.0 and later.
gotchaBasemap plots can appear distorted or incorrect if the Matplotlib figure's aspect ratio or the chosen map projection parameters are not carefully configured for the specific geographical region being plotted.
fix
Experiment with `figsize` in `plt.figure()`, and specific projection parameters like `lon_0`, `lat_0`, `width`, `height`, and `resolution` in the `Basemap` constructor. Consult Basemap examples for appropriate parameters for different projections and regions.
affects: All versions.
gotchaBasemap relies heavily on Matplotlib. Incompatibility with newer Matplotlib versions (especially those significantly beyond 3.5.0, which Basemap 2.0.0 specifies as `>=3.5.0`) can lead to unexpected rendering issues or errors.
fix
Stick to the Matplotlib version range specified in Basemap's dependencies. If using Basemap, avoid aggressively upgrading Matplotlib unless compatibility is explicitly verified.
affects: All versions, particularly with rapidly evolving Matplotlib versions.
Errors
Common errors & fixes
OSError: Could not find libproj.so.0 or libproj.dylib
The PROJ C library (or its Windows equivalent .dll) is not installed on your system or is not found in your environment's PATH. Basemap requires it for map projections.
fix
Install PROJ at the system level: `sudo apt-get install libproj-dev proj-data` (Ubuntu/Debian) or `brew install proj` (macOS). Alternatively, use `conda install -c conda-forge basemap` which bundles these dependencies.
ImportError: No module named 'mpl_toolkits.basemap'
The Basemap library is not installed in your active Python environment or was installed incorrectly.
fix
`pip install basemap` or, more reliably for its C-level dependencies, `conda install -c conda-forge basemap`. Verify installation with `python -c "import mpl_toolkits.basemap"`.
TypeError: 'Basemap' object is not callable
This error occurs when you try to use an instance of the `Basemap` class as if it were a function (e.g., `m(lon, lat)` without `inverse=False`), instead of calling its specific methods.
fix
Ensure you are calling methods on the `Basemap` instance (e.g., `m.plot`, `m.scatter`, or `m(lon, lat, inverse=False)`) and not treating the instance `m` itself as a function for coordinate transformation.
AttributeError: module 'matplotlib.pyplot' has no attribute 'figure'
Incompatibility between the installed Basemap and Matplotlib versions. Basemap 2.0.0 specifically requires Matplotlib >= 3.5.0.
fix
Downgrade or upgrade Matplotlib to a compatible version. For example, `pip install 'matplotlib>=3.5.0,<3.7.0'` to match Basemap 2.0.0's requirements, or check the Basemap documentation for the latest compatibility.
Upgrade
Version history
2.0.0latest on PyPI · released Jun 13, 2025
Audit
Dependencies
matplotlibrequiredRequired for all plotting. Basemap 2.0.0 requires Matplotlib >= 3.5.0.
numpyrequiredCore numerical dependency. Basemap 2.0.0 requires Numpy >= 1.21.0.
scipyrequiredUsed for various scientific computations. Basemap 2.0.0 requires Scipy >= 1.7.0.
projrequiredSystem-level library required for map projections. Basemap 2.0.0 specifically requires PROJ 6+ API.
geosrequiredSystem-level library required for geometric operations.
Agent activity
49 hits · last 30 days
node
44
Amazon
1
OpenAI (training)
1
Resources
basemap — pip install basemap · libregistry