Blis BLAS-like Linear Algebra Library
raw JSON → 1.3.3 verified Tue May 12 auth: no python install: verified
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 Common errors
error ERROR: Failed building wheel for blis ↓
cause 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. error ModuleNotFoundError: No module named 'blis' ↓
cause 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. error AttributeError: module 'blis' has no attribute 'py' ↓
cause 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). error ImportError: blis.cy does not export expected C function sgemm ↓
cause 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. Warnings
breaking Blis 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.
gotcha For 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`.
gotcha Blis 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.
gotcha Earlier 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.
gotcha Building `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.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 0.24s 126.5M
3.10 alpine (musl) - - 0.20s 126.5M
3.10 slim (glibc) wheel 3.8s 0.20s 119M
3.10 slim (glibc) - - 0.15s 119M
3.11 alpine (musl) wheel - 0.36s 134.2M
3.11 alpine (musl) - - 0.32s 134.2M
3.11 slim (glibc) wheel 3.7s 0.32s 126M
3.11 slim (glibc) - - 0.27s 126M
3.12 alpine (musl) wheel - 0.31s 122.6M
3.12 alpine (musl) - - 0.27s 122.6M
3.12 slim (glibc) wheel 3.7s 0.32s 114M
3.12 slim (glibc) - - 0.28s 114M
3.13 alpine (musl) wheel - 0.23s 122.1M
3.13 alpine (musl) - - 0.25s 122.0M
3.13 slim (glibc) wheel 3.5s 0.30s 114M
3.13 slim (glibc) - - 0.28s 114M
3.9 alpine (musl) build_error - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) build_error - 11.2s - -
3.9 slim (glibc) - - - -
Imports
- einsum
from blis.py import einsum - cy
cimport blis.cy
Quickstart last tested: 2026-04-24
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}")