spglib
This is the spglib module.
What it is and what it does
spglib is a Python interface to a C library for crystallographic symmetry analysis. It identifies space groups, finds symmetry operations, and handles crystal structure symmetries—core tasks in materials science, solid-state physics, and computational chemistry. The package wraps a compiled C backend and depends on numpy, importlib-resources, and typing-extensions.
It is intended for researchers and engineers working with crystal structures who need to programmatically detect and manipulate symmetries. The bindings can use either a bundled Spglib library or link to a system-installed version via LD_LIBRARY_PATH or DYLD_LIBRARY_PATH, offering flexibility in environments with pre-existing Spglib installations.
Use it for:
- Identify the space group and symmetry operations of a crystal structure from lattice and atomic positions
- Reduce a crystal structure to its primitive cell using symmetry information
- Generate equivalent atomic positions under space group symmetry operations
- Validate crystal structure symmetry in materials discovery or high-throughput screening workflows
- Integrate symmetry analysis into computational materials science pipelines
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
spglib provides Python bindings to a C library for identifying and manipulating crystal symmetries and space groups in crystallographic structures.
Yes, if you work with crystallographic data. spglib is actively maintained, carries no known vulnerabilities, supports modern Python versions (3.9–3.14), and is widely used in materials science. Medium install friction is typical for compiled bindings and poses no barrier on standard platforms. The BSD-3-Clause license is permissive.
Install
spglib on PyPI
pip
pip install spglibuv
uv add spglibpoetry
poetry add spglibInstalling spglib
Before you install
Medium install friction due to compiled C bindings, but well-supported across Python 3.9–3.14 and major platforms (macOS, Windows, Linux). Active maintenance with recent commits and no known vulnerabilities. Requires numpy pre-installation.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install spglib
import spglib
spglib.get_spacegroup((lattice, positions, numbers))
numpy must be installed before spglib; C bindings require compatible platform wheels or a system Spglib library.
Verify before relying
- Exact API surface and available symmetry operations beyond space group detection
- Performance characteristics for large crystal structures
- Whether bundled vs. system Spglib library choice affects behavior or performance
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 3 — numpy, importlib-resources, typing-extensions |
| Maintenance | actively maintained — 228 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,396,683/month — #3,960 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: spglib-2.7.0-cp310-cp310-macosx_11_0_arm64.whl; spglib-2.7.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; spglib-2.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; spglib-2.7.0-cp310-cp310-win_amd64.whl; spglib-2.7.0-cp311-cp311-macosx_11_0_arm64.whl; spglib-2.7.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; spglib-2.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; spglib-2.7.0-cp311-cp311-win_amd64.whl; spglib-2.7.0-cp311-cp311-win_arm64.whl; spglib-2.7.0-cp312-cp312-macosx_11_0_arm64.whl; spglib-2.7.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; spglib-2.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; spglib-2.7.0-cp312-cp312-win_amd64.whl; spglib-2.7.0-cp312-cp312-win_arm64.whl; spglib-2.7.0-cp313-cp313-macosx_11_0_arm64.whl; spglib-2.7.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; spglib-2.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; spglib-2.7.0-cp313-cp313-win_amd64.whl; spglib-2.7.0-cp313-cp313-win_arm64.whl; spglib-2.7.0-cp314-cp314-macosx_11_0_arm64.whl
Tags
More Physics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
pydicomPydicom reads, modifies, and writes DICOM…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
CoolPropCoolProp provides thermodynamic and transport…
permissive · top 5,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
moyopyMoyopy is a Python binding for Moyo, a crystal…
permissive · top 15,000 on PyPI
seekpathSeeK-path generates optimal k-point band paths…
permissive · top 15,000 on PyPI
pyxtalPyXtal generates crystal structures with…
permissive · top 15,000 on PyPI
gemmiGemmi is a C++ library with Python bindings for…
copyleft · top 5,000 on PyPI
symfcSymfc computes force constants from atomic…
unclear · top 15,000 on PyPI
pymatgen-corepymatgen-core provides core data structures and…
permissive · top 15,000 on PyPI
mmcifProvides native Python and C++ bindings to…
permissive · top 5,000 on PyPI
glfwPython bindings for GLFW 3 that wrap the C…
permissive · top 5,000 on PyPI
pyocseAutomates simulation workflows for organic…
permissive · top 15,000 on PyPI
aseASE provides Python tools for setting up,…
copyleft · top 5,000 on PyPI