Registry / data / blis
library1.3.3pypypi✓ verified 25d ago

Blis is a Python library that provides a high-performance, self-contained C-extension for BLAS-like dense linear algebra operations. Developed by Explosion (the creators of spaCy), it focuses on delivering fast matrix multiplication and other linear algebra routines without requiring external system dependencies. The library is actively maintained, with a current version of 1.3.3, and releases often include support for newer Python versions and updates to underlying dependencies like NumPy.

pip install blis
INSTALL
IMPORT
SIG · BLIS
B
blis
datapythonv1.3.3
Install
3.8s avg
Import
273ms
Disk
123MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 4s
py 3.11
✓ —
✓ 3.8s
py 3.12
✓ —
✓ 3.7s
py 3.13
✓ —
✓ 3.7s
py 3.9
✕ build_error
✕ build_error
123MB installed
● package 123MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

einsum
from blis.py import einsum
Provides a high-level Python API for Einstein summation, similar to NumPy's einsum but optimized for Blis routines.
cy
cimport blis.cy
Used for direct Cython access, offering fused-type, nogil bindings to the underlying Blis library.

This quickstart demonstrates how to use the high-level `einsum` function from `blis.py` for efficient matrix multiplication. It uses NumPy arrays as input and output, showcasing how Blis integrates with the NumPy ecosystem. The `einsum` function supports various tensor operations with specific restrictions that allow direct mapping to optimized Blis routines. Ensure NumPy is installed as a dependency.

import numpy as np from blis.py import einsum dim_a, dim_b, dim_c = 500, 128, 300 arr1 = np.random.rand(dim_a, dim_b).astype('float32') arr2 = np.random.rand(dim_b, dim_c).astype('float32') out = np.zeros((dim_a, dim_c), dtype='float32') # Perform matrix multiplication using einsum einsum('ab,bc->ac', arr1, arr2, out=out) print(f"Output shape: {out.shape}") # Example of returning a new array with transposed output out_transposed = einsum('ab,bc->ca', arr1, arr2) print(f"Transposed output shape: {out_transposed.shape}")
Debug
Known issues
breakingBlis versions 1.0.0 and later introduce a breaking change due to dependency on NumPy 2.0. Wheels built against NumPy 1.x are not compatible with NumPy 2.0. If you distribute binaries, they must be built against NumPy 2.x to be compatible with both NumPy 1.x and 2.x runtimes.
fix
Ensure your project's `blis` installation and any dependent packages are built against NumPy 2.x for maximum compatibility. If you are building from source, this will typically happen automatically when NumPy 2.x is present. Downstream projects using `blis` should verify their build processes with NumPy 2.x.
affects: >=1.0.0
gotchaFor optimal performance on non-x86_64 or osx/arm64 architectures, you may need to compile `blis` from source with specific architecture flags. The provided wheels are optimized for common architectures, but for other CPUs, a generic (slower) build might be used unless `BLIS_ARCH` environment variable is set during installation.
fix
If experiencing poor performance on specific hardware, refer to the `blis` GitHub repository documentation on 'Building BLIS for alternative architectures' and install using `BLIS_ARCH="your_arch" pip install blis --no-binary blis`.
affects: all
gotchaBlis is designed for single-threaded execution for its intended workloads (ML inference). While it is re-entrant and safe to use concurrently from multiple threads with immutable data, concurrent mutation of input NumPy arrays from different threads while Blis is running can lead to data races or segmentation faults.
fix
Avoid concurrent mutation of NumPy arrays used as input to Blis operations across multiple threads. Ensure data is immutable during Blis computations or manage threading carefully at a higher level.
affects: all
gotchaEarlier versions around `v1.0.0` experienced memory access errors and instability on Windows. This issue was addressed in `v1.2.0` by reverting to an older, more stable version of the vendored Blis library.
fix
Users on Windows encountering instability should upgrade to `blis` version `1.2.0` or newer.
affects: >=1.0.0, <1.2.0
gotchaBuilding `blis` from source requires a C compiler (e.g., `gcc` on Linux, Clang/Xcode on macOS, MSVC on Windows). If a pre-built wheel is not available for your platform and Python version, or if you explicitly request a source build, compilation will fail without a suitable compiler installed.
fix
Ensure a C compiler is installed and accessible in your environment. On Debian/Ubuntu systems, install `build-essential` (`apt-get install build-essential`). On macOS, install Xcode Command Line Tools (`xcode-select --install`). On Windows, install Microsoft Visual C++ Build Tools.
affects: all
Errors
Common errors & fixes
ERROR: Failed building wheel for blis
This error indicates that `pip` failed to compile the `blis` library from its source code, often due to missing C/C++ build tools on the system or architectural incompatibilities when pre-compiled wheels are not available.
fix
Install necessary build tools for your operating system (e.g., 'build-essential' on Linux, 'Microsoft Visual C++ Build Tools' on Windows) and ensure `pip`, `setuptools`, and `wheel` are up-to-date. For specific architectures, you might need to set the `BLIS_ARCH` environment variable before installing (e.g., `BLIS_ARCH='generic' pip install --no-binary blis`). Alternatively, use `conda install -c conda-forge blis` if using Anaconda/Miniconda, as it often handles binary dependencies more effectively.
ModuleNotFoundError: No module named 'blis'
This error occurs when the Python interpreter cannot find the `blis` module, either because it was not successfully installed, is installed in a different Python environment, or is not correctly packaged/found when used with certain tools (like Nuitka).
fix
Ensure `blis` is installed in your active Python environment using `pip install blis`. If you have multiple Python versions, confirm you are using the `pip` associated with the correct Python interpreter. If bundling your application (e.g., with Nuitka), check the documentation for how to include C extensions or specific packages.
AttributeError: module 'blis' has no attribute 'py'
This error arises when trying to access a non-existent submodule or attribute named 'py' directly within the `blis` module. The high-level Python API functions are typically exposed directly under the `blis` module or its submodules like `blis.ru`, not through a '.py' attribute.
fix
Consult the `blis` documentation for the correct way to import and use its functions. Most high-level operations are accessed directly from the `blis` package (e.g., `import blis; blis.gemm(...)`) or from specific submodules (e.g., `from blis.ru import gemm`).
ImportError: blis.cy does not export expected C function sgemm
This issue suggests a problem with the `blis` Cython extension (`blis.cy`), where it fails to expose a required BLAS function (like `sgemm`), typically due to a corrupted installation, an incomplete compilation, or conflicts with other BLAS implementations on the system.
fix
Perform a clean reinstallation of `blis` in a fresh virtual environment. You can try `pip install --no-cache-dir --force-reinstall blis`. If you are compiling `blis` from source or linking against a custom BLAS, ensure that the compilation process completes successfully and that `blis` is correctly configured to include the necessary CBLAS functions.
Upgrade
Version history
1.3.3latest on PyPI · released Nov 17, 2025
Audit
Dependencies
numpyrequiredRequired for array handling and integration with the Python numerical ecosystem.
Agent activity
34 hits · last 30 days
node
30
Amazon
1
OpenAI (training)
1
Resources
blis — pip install blis · libregistry