Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

156.2. numpy-2.5.3

N-dimensional array library for Python

Version 2.5.3, release 1
Shelf sci-libs — Numerical and scientific-data libraries, and the unprefixed core Python science stack
Phase 41_system (System), 55 of 1047 in build order
Licence BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0
Homepage https://pypi.org/project/numpy/
Build time 3.8 SBU
Installed size 25.3 MiB in 608 files
Recipe ports/core/sci-libs/numpy/kpkgbuild

About

NumPy is Python’s N-dimensional array type and the numerical routines built on it. It is the base of the scientific Python stack in KDOS: scipy, matplotlib, pandas and astropy import it, and so do the Python parts of gnuradio, opencv, gdal and blender. It is built from source with meson through pip, and its linear algebra goes to openblas.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/sci-libs.txt:

The array type, and what makes the shipped python a calculator. No wheels exist for musl+3.14, so this is a from-source meson build; openblas is what the linear algebra lands on rather than numpy's bundled reference kernels.

Sources

Dependencies

Depends on: python3, python3-setuptools, python3-pip, python3-meson-python, python3-cython, meson, ninja, openblas.

Required by (40): astropy, bcnc, blender, boost, coolprop, cura, freecad, gdal, gnuradio, gr-funcube, gr-iqbal, ifcopenshell, inkscape, linuxcnc, matplotlib, netgen, onnxruntime, opencv, openimageio, pandas, piper, python3-contourpy, python3-h5py, python3-iminuit, python3-jplephem, python3-pyerfa, python3-pyqtgraph, python3-pyside6, python3-sgp4, python3-shapely, python3-wxpython, qgis, scipy, selenium-webdriver-at-spi, sideband, skyfield, uhd, uranium, urh, veusz.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install numpy'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/sci-libs/numpy.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/sci-libs/numpy
echo 'df2d5874ff183595a4ba404edd04f6bd9b5505c1d7708573f6a6c17489a67563  numpy-2.5.3.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/numpy
SRC=$SRC_ROOT/numpy-2.5.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf numpy-2.5.3.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

export CFLAGS="${CFLAGS/-O2/-O3}" CXXFLAGS="${CXXFLAGS/-O2/-O3}"
pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root=$PKG --prefix=/usr \
	-Csetup-args=-Dcpu-baseline=none \
	-Csetup-args=-Dblas=openblas \
	-Csetup-args=-Dlapack=openblas \
	-Csetup-args=-Dallow-noblas=false \
	.
find "$PKG"/usr/lib/python3*/site-packages/numpy -type d -name tests -prune -exec rm -rf {} +

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/numpy, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf numpy-2.5.3-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/numpy, and runs the triggers its paths call for.

Contents

Installed programs: f2py, numpy-config.

Installed directories: /usr/lib/python3.14/site-packages/numpy, /usr/lib/python3.14/site-packages/numpy-2.5.3.dist-info, /usr/share/licenses/numpy.

Short descriptions

numpy.pc NumPy is the fundamental package for scientific computing with Python.

Notes

The meson that configures NumPy is not the meson port. pyproject.toml names vendored-meson/meson/meson.py, a copy NumPy carries with its own changes for its CPU feature handling, and meson-python runs that one.

Upstream installs its test suites into the package (--tags=…,tests,… in pyproject.toml). The find … -name tests -prune -exec rm -rf after the install removes every tests directory under numpy/ from the package.