numexpr
Fast numerical expression evaluator for NumPy
What it is and what it does
NumExpr is a numerical expression evaluator that accelerates array computations by parsing expressions into its own virtual machine bytecode and executing them in chunks that fit in CPU cache. Instead of creating intermediate arrays for each operation (as NumPy does), it processes small chunks of data across all available CPU cores, reducing memory pressure and improving cache locality. This approach typically yields speedups between 0.95x and 4x for common expressions, with larger gains possible for complex mathematical operations.
The package works by taking string expressions like `'a*b-4.1*a > 2.5*b'` and evaluating them on NumPy arrays without materializing temporary results. It supports arithmetic, comparison, and transcendental functions (sin, arcsinh, etc.), and can also operate on string arrays. Performance benefits are most pronounced on large arrays; small arrays may see minimal or no improvement. The package optionally integrates with Intel's MKL for further acceleration of transcendental functions on Intel architectures.
Use it for:
- Accelerate large-scale numerical computations in data analysis pipelines where memory bandwidth is a bottleneck.
- Evaluate complex mathematical expressions on multi-gigabyte arrays without exhausting available RAM.
- Speed up scientific simulations that repeatedly apply the same expression to different array chunks.
- Parallelize array operations across CPU cores for workloads that would otherwise be single-threaded in NumPy.
- Reduce memory footprint in memory-constrained environments by avoiding intermediate array allocation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
NumExpr evaluates numerical expressions on NumPy arrays with multi-threaded acceleration and reduced memory overhead, typically achieving 0.95x to 4x speedups over direct NumPy operations.
Yes. NumExpr is actively maintained, has no known vulnerabilities, and offers genuine performance benefits for large-array numerical workloads. The MIT license imposes no restrictions. Install it if you regularly work with large NumPy arrays and need to squeeze performance from complex expressions; skip it for small arrays or simple operations where overhead outweighs gains.
Install
numexpr on PyPI
pip
pip install numexpruv
uv add numexprpoetry
poetry add numexprInstalling numexpr
Before you install
Medium install friction due to compiled wheels for multiple platforms and Python versions. Active maintenance with a recent release (27 days ago) and 2532 repository stars indicate solid ongoing support.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, making it suitable for both open-source and proprietary projects.
Quickstart
pip install numexpr
import numpy as np
import numexpr as ne
a = np.arange(1e6)
b = np.arange(1e6)
result = ne.evaluate("a * b - 4.1 * a > 2.5 * b")
Requires NumPy; best performance gains on large arrays that exceed L1 CPU cache size.
Verify before relying
- Whether Intel MKL integration (mentioned in docs) is available in standard pip wheels or requires separate configuration.
- Actual performance gains on your specific hardware and expression complexity (documentation notes 0.95x to 4x range but results vary).
- Free-threading support status on CPython 3.13+ and any threading interaction caveats beyond what the description states.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 27 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 16,838,156/month — #1,137 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: numexpr-2.14.2-cp311-cp311-macosx_10_9_x86_64.whl; numexpr-2.14.2-cp311-cp311-macosx_11_0_arm64.whl; numexpr-2.14.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; numexpr-2.14.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; numexpr-2.14.2-cp311-cp311-musllinux_1_2_aarch64.whl; numexpr-2.14.2-cp311-cp311-musllinux_1_2_x86_64.whl; numexpr-2.14.2-cp311-cp311-win32.whl; numexpr-2.14.2-cp311-cp311-win_amd64.whl; numexpr-2.14.2-cp311-cp311-win_arm64.whl; numexpr-2.14.2-cp312-cp312-macosx_10_13_x86_64.whl; numexpr-2.14.2-cp312-cp312-macosx_11_0_arm64.whl; numexpr-2.14.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; numexpr-2.14.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; numexpr-2.14.2-cp312-cp312-musllinux_1_2_aarch64.whl; numexpr-2.14.2-cp312-cp312-musllinux_1_2_x86_64.whl; numexpr-2.14.2-cp312-cp312-win32.whl; numexpr-2.14.2-cp312-cp312-win_amd64.whl; numexpr-2.14.2-cp312-cp312-win_arm64.whl; numexpr-2.14.2-cp313-cp313-macosx_10_13_x86_64.whl; numexpr-2.14.2-cp313-cp313-macosx_11_0_arm64.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
Theano-PyMCTheano-PyMC is an optimizing compiler for…
permissive · top 15,000 on PyPI
TheanoTheano is a Python library for defining,…
permissive · top 15,000 on PyPI
onemkl-sycl-sparseProvides C and Data Parallel C++ (DPC++)…
unclear · top 15,000 on PyPI
snuggsSnuggs evaluates s-expressions (Lisp-like…
permissive · top 15,000 on PyPI
mklIntel oneAPI Math Kernel Library provides…
unclear · top 15,000 on PyPI
onemkl-sycl-blasProvides optimized C and Data Parallel C++…
unclear · top 15,000 on PyPI
array-recordArrayRecord is a file format for storing and…
permissive · top 5,000 on PyPI
pytensorPyTensor is a Python library for defining,…
permissive · top 5,000 on PyPI
array-api-strictProvides a strict, minimal implementation of…
permissive · top 15,000 on PyPI
fxpmathFxpmath provides fixed-point arithmetic with…
permissive · top 15,000 on PyPI