libpysal
Core components of PySAL - A library of spatial analysis functions
What it is and what it does
libpysal is the foundational library for the PySAL (Python Spatial Analysis Library) ecosystem, providing five core modules: computational geometry (cg), built-in example datasets, a graph class for spatial weights matrices, input/output utilities, and legacy spatial weights support. It sits at the base of a larger family of spatial analysis packages and is designed to be imported and used by downstream PySAL tools rather than as a standalone end-user application.
The package depends on a substantial stack including geopandas, scipy, scikit-learn, numpy, pandas, and shapely, making it suitable for environments already engaged in scientific computing or geospatial work. It targets researchers and practitioners in spatial statistics and GIS applications who need reliable, well-maintained primitives for building spatial analysis workflows.
Use it for:
- Build spatial weights matrices and graph representations for spatial econometric or statistical models.
- Access computational geometry operations as a foundation for custom spatial analysis tools.
- Load and work with built-in example datasets for prototyping or teaching spatial analysis concepts.
- Integrate spatial analysis capabilities into downstream PySAL packages or custom geospatial applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
libpysal provides core spatial analysis building blocks—computational geometry, spatial weights matrices, graph representations, and example datasets—that underpin the broader PySAL ecosystem.
Yes, if you are building spatial analysis workflows or using other PySAL packages—libpysal is a required foundation. The active maintenance, permissive license, low install friction, and zero known vulnerabilities make it a safe dependency. Not necessary as a standalone tool for general users; install only if spatial weights, computational geometry, or PySAL integration is part of your project.
Install
libpysal on PyPI
pip
pip install libpysaluv
uv add libpysalpoetry
poetry add libpysalInstalling libpysal
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with a recent release 42 days ago and ongoing GitHub activity; requires Python 3.12 or later.
License in practice
BSD 3-Clause permissive license allows use in commercial and proprietary projects with minimal restrictions beyond attribution.
Quickstart
pip install libpysal
import libpysal
from libpysal.weights import Queen
from libpysal.examples import load_example
# Load example geodataframe
gdf = load_example('columbus')
# Create spatial weights from geometry
w = Queen.from_dataframe(gdf)
Requires Python 3.12 or later; geopandas and its geospatial dependencies (GEOS, PROJ) must be installed and functional.
Verify before relying
- Whether the 11 runtime dependencies (including geopandas, scipy, scikit-learn) are all required for basic use or if some are optional for specific modules.
- Performance characteristics or scalability limits for large spatial datasets or graphs.
Package facts
| License | BSD 3-Clause (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 11 — beautifulsoup4, geopandas, jinja2, numpy, packaging, pandas, platformdirs, requests, scikit-learn, scipy, shapely |
| Maintenance | actively maintained — 42 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 523,733/month — #6,193 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: libpysal-4.15.0-py3-none-any.whl
Keywords: spatial statistics, spatial graphs
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
inequalityInequality provides methods for measuring…
permissive · top 15,000 on PyPI
pysalPySAL is a meta-package that bundles 29 spatial…
permissive · top 15,000 on PyPI
splotsplot creates static and interactive…
permissive · top 15,000 on PyPI
esdaesda computes global and local spatial…
permissive · top 15,000 on PyPI
spaghettiSpaghetti analyzes network-based spatial data…
permissive · top 15,000 on PyPI
pointpatsPointpats provides statistical methods for…
permissive · top 15,000 on PyPI
segregationCalculates over 40 segregation indices—both…
permissive · top 15,000 on PyPI
accessCalculates spatial accessibility metrics to…
permissive · top 15,000 on PyPI
spatial-accessComputes travel times and spatial access…
permissive · top 15,000 on PyPI
pyalexPyAlex is a Python interface to the OpenAlex…
permissive · top 15,000 on PyPI