Install & Compatibility
Where this runs
tested against v0.49.0 · 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
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.0s · import 0.014s · 190MB
179MB installed
● package 179MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ir
✓ from llvmlite import ir
Used for building LLVM Intermediate Representation (IR) in pure Python.
binding
✓ import llvmlite.binding as llvm
Used for interacting with the LLVM runtime, including parsing IR, creating execution engines, and JIT compilation.
This example demonstrates how to define a simple floating-point addition function using `llvmlite.ir`, compile it using `llvmlite.binding`, and execute it via `ctypes`. It covers IR construction, module parsing, execution engine setup, and function invocation.
from ctypes import CFUNCTYPE, c_double
from llvmlite import ir
import llvmlite.binding as llvm
# All these initializations are required for JIT compilation
llvm.initialize_native_target()
llvm.initialize_native_asmprinter()
# Define the LLVM IR for a simple function (double fpadd(double a, double b) { return a + b; })
double = ir.DoubleType()
fnty = ir.FunctionType(double, (double, double))
module = ir.Module(name=__file__)
func = ir.Function(module, fnty, name="fpadd")
block = func.append_basic_block(name="entry")
builder = ir.IRBuilder(block)
a, b = func.args
result = builder.fadd(a, b, name="res")
builder.ret(result)
# Convert textual LLVM IR into in-memory representation
llvm_module = llvm.parse_assembly(str(module))
llvm_module.verify()
# Create an ExecutionEngine suitable for JIT code generation
target = llvm.Target.from_default_triple()
target_machine = target.create_target_machine()
engine = llvm.create_mcjit_compiler(llvm_module, target_machine)
# Finalize the engine to make the function available
engine.finalize_object()
engine.run_static_constructors()
# Look up the function pointer and cast it to a C function
func_ptr = engine.get_function_address("fpadd")
cfunc = CFUNCTYPE(c_double, c_double, c_double)(func_ptr)
# Run the function
res = cfunc(1.0, 2.5)
print(f"Result of fpadd(1.0, 2.5): {res}") # Expected: 3.5
Errors
Common errors & fixes
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
This error occurs during `llvmlite` installation (especially when building from source) because the `llvm-config` executable, which is used to locate LLVM libraries and headers, cannot be found in the system's PATH or at the location specified by the `LLVM_CONFIG` environment variable. This often happens on systems without a proper LLVM development installation or when `pip` attempts to build `llvmlite` from a source distribution due to an unsupported Python version or architecture.
fixEnsure that LLVM development packages are installed and `llvm-config` is in your system's PATH. If using `pip`, try `pip install llvmlite` and if it fails, consider using `conda install llvmlite` as it typically provides pre-built binaries that include a compatible LLVM. If building from source, set the `LLVM_CONFIG` environment variable to the full path of your `llvm-config` executable (e.g., `export LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config`).
ImportError: Numba requires at least version X.Y.Z of llvmlite. Installed version is A.B.C. Please update llvmlite.
This error arises when the installed versions of `Numba` and `llvmlite` are incompatible. `Numba` has a strict dependency on specific `llvmlite` versions, and if `llvmlite` is older than required, this error is raised.
fixUpdate `llvmlite` to the version specified or a compatible one with your `Numba` installation, usually by running `pip install --upgrade llvmlite` or `conda update llvmlite`. It's often best to let `conda` manage both, e.g., `conda install numba llvmlite`.
RuntimeError: Building llvmlite requires LLVM X.Y+ Be sure to set LLVM_CONFIG to the right executable path.
This indicates that `llvmlite` could not find a suitable LLVM installation (specifically version X.Y or newer) during its build process. It explicitly suggests setting the `LLVM_CONFIG` environment variable to point to the correct `llvm-config` executable.
fixInstall the required LLVM version (e.g., via your system's package manager, Homebrew, or by compiling from source) and then set the `LLVM_CONFIG` environment variable to the absolute path of the `llvm-config` executable for that LLVM installation before attempting to install `llvmlite` again. For example: `export LLVM_CONFIG=/path/to/llvm-X.Y/bin/llvm-config` followed by `pip install llvmlite`.
OSError: Could not find/load shared object file
This error occurs when `llvmlite`'s Python bindings (specifically `llvmlite.binding`) cannot find or load the underlying shared library (`libllvmlite.so`, `.dll`, or `.dylib`). This often points to a failed or incomplete build of `llvmlite` itself, or an incompatibility with the system's LLVM libraries if `llvmlite` was not statically linked or linked against a mismatched LLVM version.
fixReinstall `llvmlite` using a reliable method, preferably `conda install llvmlite` to leverage pre-built, statically linked packages. If using `pip` and encountering issues, ensure you have the necessary build tools (like `cmake`, `g++`, Visual Studio on Windows) and a compatible LLVM installation (as referenced by `LLVM_CONFIG`) for your system and Python version.
ModuleNotFoundError: No module named 'llvmlite'
This error means that the Python interpreter cannot find the `llvmlite` package. This typically happens if `llvmlite` was not successfully installed, was installed in a different Python environment, or the current environment's `PYTHONPATH` does not include the installation directory.
fixInstall `llvmlite` using `pip install llvmlite` or `conda install llvmlite`. Ensure you are installing it into the correct Python environment that you are currently using. If it was already installed, verify the environment or check your `PYTHONPATH`.
Upgrade
Version history
0.49.0latest on PyPI · released Aug 11, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer (Python 3.9 support dropped in 0.44.0).
LLVMoptionalllvmlite packages from Numba maintainers statically link LLVM. However, if building from source or using dynamically-linked packages (e.g., from conda-forge), a compatible LLVM installation (including development files and C++ compiler/CMake) is required. llvmlite 0.45.0+ requires LLVM 20.x.x.