nilearn
Statistical learning for neuroimaging in Python
What it is and what it does
Nilearn is a Python library for statistical and machine-learning analysis of brain imaging data. It integrates scikit-learn's multivariate statistics with neuroimaging-specific tools, supporting general linear model (GLM) analysis on brain volumes and surfaces. The package is designed for researchers and developers working with fMRI, structural imaging, or other neuroimaging modalities who need accessible statistical and predictive modeling capabilities.
The library depends on core scientific Python packages (numpy, scipy, pandas, scikit-learn, nibabel) for numerical computation and neuroimaging file handling. It includes optional plotting support via matplotlib and plotly. The project maintains active development with regular releases, comprehensive documentation, and a community-oriented approach including weekly drop-in hours for user support.
Use it for:
- Perform GLM-based statistical analysis on fMRI data to identify brain regions associated with experimental conditions
- Build predictive models for brain decoding tasks using multivariate pattern analysis with scikit-learn integration
- Analyze functional connectivity between brain regions and classify brain states from imaging data
- Visualize and explore brain volume and surface data with integrated plotting tools
- Conduct group-level statistical inference on neuroimaging datasets across multiple subjects
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Nilearn provides statistical and machine-learning tools for analyzing brain imaging data, supporting GLM-based analysis and multivariate statistics via scikit-learn integration.
Yes. Nilearn is actively maintained, has low install friction, carries a permissive license, and addresses a specific scientific need with established community support. It is well-suited for researchers and developers doing neuroimaging analysis in Python. No known security vulnerabilities.
Install
nilearn on PyPI
pip
pip install nilearnuv
uv add nilearnpoetry
poetry add nilearnInstalling nilearn
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with a recent release 43 days ago and ongoing repository activity. Requires Python 3.10 or later.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions, requiring only preservation of copyright and license notices.
Quickstart
pip install nilearn
import nilearn
from nilearn import image
# Load and analyze brain imaging data using nilearn's statistical tools
Requires Python 3.10 or later. Optional plotting features require matplotlib >= 3.8.0 or plotly + kaleido for advanced visualization.
Verify before relying
- Whether the package's GLM analysis and multivariate statistics capabilities cover your specific neuroimaging use case
- Performance characteristics when working with large-scale brain imaging datasets
- Availability and quality of community support beyond the documented drop-in hours
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — jinja2, joblib, nibabel, numpy, packaging, pandas, requests, scikit-learn, scipy |
| Maintenance | actively maintained — 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 287,281/month — #8,035 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nilearn-0.14.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pybidsPyBIDS provides a Python interface to query,…
permissive · top 15,000 on PyPI
mneMNE-Python provides tools for exploring,…
permissive · top 5,000 on PyPI
dipyDIPY is a Python library for analyzing…
permissive · top 15,000 on PyPI
mne-bidsMNE-BIDS reads and writes neuroimaging datasets…
permissive · top 15,000 on PyPI
dask-glmDistributed generalized linear model fitting…
permissive · top 15,000 on PyPI
pyxnatpyxnat provides Python bindings to interact…
permissive · top 15,000 on PyPI
bidsschematoolsParse, validate, and export the Brain Imaging…
permissive · top 15,000 on PyPI
statsmodelsstatsmodels provides statistical models,…
permissive · top 1,000 on PyPI
nipypeNipype provides a uniform Python interface to…
permissive · top 15,000 on PyPI
neoNeo provides a unified data model for…
permissive · top 15,000 on PyPI