Installing SciPy and the subpackage map

Install SciPy so it matches your NumPy, then learn which of the fifteen subpackages solves which kind of numerical problem.

Installation and version pairing

python -m venv .venv && source .venv/bin/activate

# the usual route: wheels that already bundle the compiled libraries
pip install numpy scipy

# from a fully specified environment
pip install -r requirements.txt
python -c "import scipy, numpy; print(scipy.__version__, numpy.__version__)"

SciPy is mostly compiled code. Install it from a binary wheel wherever possible; building from source needs a Fortran compiler, OpenBLAS and a lot of patience, and is rarely necessary outside platform packaging.

  • SciPy declares a required NumPy range. Mixing a much newer NumPy with an older SciPy produces ValueError or ImportError about ABI version at import time.
  • Do not overwrite a system or conda environment with pip install --user; create a dedicated environment per project.
  • On ARM machines, check scipy.show_config() to confirm which BLAS backend you actually linked against.

The subpackage map

SubpackageSolvesTypical call
scipy.linalgDense linear algebra: factorisations, solvers, eigenvaluessolve, lu, eigh
scipy.sparseMatrices that are mostly zeroscsr_matrix, spsolve
scipy.optimizeMinimisation, root finding, curve fittingminimize, brentq, curve_fit
scipy.integrateQuadrature and ODE solversquad, solve_ivp
scipy.interpolateFilling in between known pointsCubicSpline, RBFInterpolator
scipy.statsDistributions, tests, descriptive statisticsnorm.fit, ttest_ind
scipy.signalFilter design and application, peak detectionbutter, find_peaks
scipy.fftFast Fourier transformsrfft, spectrogram
scipy.ndimageN-dimensional image operationsgaussian_filter, label
scipy.spatialNearest neighbours, geometry, distancecKDTree, Delaunay
scipy.specialSpecial mathematical functionsgammaln, erfc, comb

Import subpackages explicitly (from scipy import linalg) rather than relying on import scipy. The top-level namespace is deliberately thin, so attribute access there is a common source of AttributeError.

💡
Work out which subpackage owns your problem before you start coding. Half of the answers on a search engine use the wrong tool simply because the solver looked close enough, and you only notice when the numbers are subtly wrong.

FAQ

Do I need SciPy if I already have NumPy?
Only for problems NumPy does not cover well: sparse matrices, ODE solvers, quadrature, statistical tests, signal processing, image morphology, spatial indexes. Everything SciPy returns is a NumPy array, so the two work together rather than in competition.
Why does import fail with a NumPy ABI error?
The installed SciPy was compiled against a different NumPy major version. Upgrade both together with pip install --upgrade numpy scipy, or pin a known-good pair in your requirements file.

SciPy arrays and NumPy interop Linear algebra with scipy.linalg

Last refreshed 2026-09-18.