Installation¶

Requirements¶

  • Python 3.9+

  • pip 23+

Install from PyPI¶

pip install onnx-ir

Install from source¶

git clone https://github.com/onnx/ir-py.git
cd ir-py
pip install -e .

Verify installation¶

python -c "import onnx_ir as ir; print(ir.__version__)"

Optional integrations¶

Install optional packages only for the workflows that need them:

Package

Purpose

onnx-shape-inference

IR-native symbolic shape inference with SymPy expressions and shape-data propagation

safetensors>=0.7.0

Save model weights with ir.save_safetensors

rich

Syntax-highlighted display() output and paging

torch

PyTorch tensor adapter and dtype conversion utilities

pip install onnx-shape-inference "safetensors>=0.7.0" rich

ONNX IR does not require these packages for its core model, graph, and tensor APIs. See Model I/O, Tensor Representation, and Debugging transformations for integration-specific usage.