healpy
Healpix tools package for Python
What it is and what it does
healpy is a Python wrapper around the HEALPix C++ library, designed to work with pixelated data distributed uniformly across the sphere. It was originally developed for Cosmic Microwave Background analysis but is now used across astrophysics for all-sky survey data storage and manipulation. The package provides utilities to convert between sky coordinates and pixel indices, transform between reference frames (Galactic, Ecliptic, Equatorial), read and write FITS-format maps, and compute spherical harmonics transforms using multi-threaded C++ routines.
The package depends on numpy and astropy as runtime dependencies, with optional matplotlib support for visualization. It ships prebuilt wheels for modern Python versions (3.10–3.14) on Linux, macOS, and musllinux, reducing compilation friction for most users. However, it bundles the HEALPix and cfitsio C++ libraries, so installation may require a C++ compiler on some systems. The codebase is actively maintained and carries no known security vulnerabilities.
Use it for:
- Analyze Cosmic Microwave Background maps from experiments like WMAP or Planck by converting sky coordinates to HEALPix indices and computing power spectra.
- Process all-sky survey data (e.g., radio, infrared, X-ray) by upgrading/downgrading map resolution and applying coordinate transformations.
- Visualize spherical data in multiple projections (Mollweide, Gnomonic, Cartographic) for publication-ready figures.
- Transform maps between spherical harmonics space and pixel space for efficient filtering or statistical analysis.
- Find pixels within arbitrary sky regions (disks, polygons, strips) for targeted data extraction from large surveys.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
healpy wraps the HEALPix C++ library to handle pixelated data on the sphere, enabling coordinate conversions, map transformations, spherical harmonics analysis, and visualization of all-sky survey data.
Yes, if you work with all-sky or spherical survey data in astrophysics. The package is production-stable, actively maintained, has no security issues, and prebuilt wheels make installation straightforward on supported platforms. The GPL-2.0 copyleft license is standard in academic astronomy but requires review for commercial use. Not suitable for Windows systems.
Install
healpy on PyPI
pip
pip install healpyuv
uv add healpypoetry
poetry add healpyInstalling healpy
Before you install
Medium friction: prebuilt wheels available for Python 3.10–3.14 on Linux, macOS, and musllinux, but the package bundles HEALPix and cfitsio C++ libraries. Active maintenance (latest release 22 days old, last commit 2026-07-27) and no known vulnerabilities.
License in practice
GPL-2.0-only copyleft: any derivative work or distribution must also be open-source under GPL-2.0 or compatible terms. Suitable for research and open-source projects; commercial use requires careful licensing review.
Quickstart
pip install healpy
import healpy as hp
import numpy as np
# Create a simple HEALPix map
nside = 64
m = np.random.randn(hp.nside2npix(nside))
# Convert sky coordinates to pixel indices
pix = hp.ang2pix(nside, theta=1.0, phi=2.0)
# Visualize in Mollweide projection
hp.mollview(m)
Requires a C++ compiler and development headers; healpy does not support Windows. Python 3.10 or later required.
Verify before relying
- Whether matplotlib is a runtime dependency or only required for visualization features
- Whether prebuilt wheels include OpenMP support or if compilation is needed on some systems
- Performance characteristics for large-scale all-sky survey datasets
Package facts
| License | GPL-2.0-only (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 2 — numpy, astropy |
| Maintenance | actively maintained — 22 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 301,258/month — #7,839 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: healpy-1.20.0-cp310-cp310-macosx_13_0_x86_64.whl; healpy-1.20.0-cp310-cp310-macosx_14_0_arm64.whl; healpy-1.20.0-cp310-cp310-macosx_15_0_arm64.whl; healpy-1.20.0-cp310-cp310-manylinux_2_28_aarch64.whl; healpy-1.20.0-cp310-cp310-manylinux_2_28_x86_64.whl; healpy-1.20.0-cp310-cp310-musllinux_1_2_aarch64.whl; healpy-1.20.0-cp310-cp310-musllinux_1_2_x86_64.whl; healpy-1.20.0-cp311-cp311-macosx_13_0_x86_64.whl; healpy-1.20.0-cp311-cp311-macosx_14_0_arm64.whl; healpy-1.20.0-cp311-cp311-macosx_15_0_arm64.whl; healpy-1.20.0-cp311-cp311-manylinux_2_28_aarch64.whl; healpy-1.20.0-cp311-cp311-manylinux_2_28_x86_64.whl; healpy-1.20.0-cp311-cp311-musllinux_1_2_aarch64.whl; healpy-1.20.0-cp311-cp311-musllinux_1_2_x86_64.whl; healpy-1.20.0-cp312-cp312-macosx_13_0_x86_64.whl; healpy-1.20.0-cp312-cp312-macosx_14_0_arm64.whl; healpy-1.20.0-cp312-cp312-macosx_15_0_arm64.whl; healpy-1.20.0-cp312-cp312-manylinux_2_28_aarch64.whl; healpy-1.20.0-cp312-cp312-manylinux_2_28_x86_64.whl; healpy-1.20.0-cp312-cp312-musllinux_1_2_aarch64.whl
Tags
More Visualization packages
matplotlib creates static, animated, and…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
plotlyPlotly is an interactive, browser-based…
permissive · top 1,000 on PyPI
graphvizGenerates DOT language source code for graph…
permissive · top 1,000 on PyPI
streamlitStreamlit transforms Python scripts into…
permissive · top 1,000 on PyPI
leatherLeather is a lightweight Python charting…
permissive · top 1,000 on PyPI
astropy-healpixProvides HEALPix spherical pixelization for…
permissive · top 15,000 on PyPI
reprojectReproject astronomical images between different…
permissive · top 15,000 on PyPI
regionsRegions provides tools for defining,…
permissive · top 15,000 on PyPI
gwcsGWCS provides tools for managing World…
unclear · top 15,000 on PyPI
spatial_imagespatial-image provides an N-dimensional spatial…
permissive · top 15,000 on PyPI
CartopyCartopy makes it easy to draw maps for data…
permissive · top 5,000 on PyPI
leafmapLeafmap enables interactive geospatial mapping…
permissive · top 15,000 on PyPI
PyAVMPyAVM reads, writes, and embeds Astronomy…
permissive · top 15,000 on PyPI