How to install onnx-light#
This guide covers the Python interface. For the other language, see How to install onnx-light.
This page covers onnx-light installation for Python, including local development, faster builds, and basic post-install validation.
Common install patterns#
Install for local development#
pip install -e .[dev] -v
Speed up the build#
CMAKE_BUILD_PARALLEL_LEVEL=8 pip install -e .[dev]
Verify the install#
python -c "import onnx_light; print(onnx_light.__version__)"
Load a model with the proto-only target#
import onnx_light.onnx as onnxl
model = onnxl.load("model.onnx")
Notes#
Python editable installs pull build dependencies from
pyproject.tomland build the extension in place for local development.The C++ install flow exports CMake targets under
onnx_light::...and does not require building the Python extension when-DONNX_LIGHT_BUILD_PYTHON=OFFis set.If the C++ library is installed to a non-standard prefix, configure the downstream project with
-DCMAKE_PREFIX_PATH=<prefix>before callingfind_package(onnx_light REQUIRED).Use
onnx_light::lib_onnx_libfor higher-level ONNX features such as checker, shape inference, or version conversion. Useonnx_proto::lib_onnx_protowhen the downstream code only needs proto parsing and serialization.