skillfed

numexpr

Fast numerical expression evaluator for NumPy

numexpr v2.14.2 16.8M downloads/30d#1,137 on PyPI2,532
Permissive license MIT Active released

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 numexpr

uv

uv add numexpr

poetry

poetry add numexpr

Installing 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

Development Status :: 6 - MatureIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules

Tags

fast numpy array expressionsnumerical expression evaluatornumpy array computation speedupparallel array operationsmemory-efficient array mathnumpy expression optimizationmulti-threaded array evaluation
performance-optimizationnumerical-computing

More Python Modules packages