skillfed

libpysal

Core components of PySAL - A library of spatial analysis functions

libpysal v4.15.0 523.7K downloads/30d#6,193 on PyPI292
Permissive license BSD 3-Clause Active released

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 libpysal

uv

uv add libpysal

poetry

poetry add libpysal

Installing 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

Intended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: GIS

Tags

spatial weights matricescomputational geometry pythonspatial graph analysisspatial statistics librarypysal core componentsspatial analysis building blocksgis python library
spatial-analysisgisscientific-computing

More GIS packages