skl2onnx
Convert scikit-learn models to ONNX
What it is and what it does
skl2onnx is a converter that takes trained scikit-learn models and transforms them into ONNX (Open Neural Network Exchange) format, an open standard for representing machine learning models. Once converted, models can be deployed and executed using ONNX Runtime or other ONNX-compatible inference engines. The package handles scikit-learn pipelines, individual models, and transformers, with support for external converters to extend functionality. It supports opset 21 and has been tested against onnxruntime.
The conversion workflow is straightforward: train a scikit-learn model, call to_onnx() with a sample input, serialize the result, and load it into an inference runtime. This is useful for deploying models in production environments where portability or interoperability with other ML frameworks matter.
Use it for:
- Deploy scikit-learn models to production systems using ONNX Runtime.
- Convert scikit-learn pipelines to a portable format that can run on different platforms or languages via ONNX.
- Integrate scikit-learn models into applications that require ONNX format for compatibility with existing inference infrastructure.
- Export trained models for use in edge devices or resource-constrained environments where ONNX Runtime is available.
- Register external converters to extend ONNX support for models or transformers from external libraries.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts trained scikit-learn models to ONNX format for deployment and high-performance inference using ONNX Runtime or other compatible tools.
Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real deployment problem—getting scikit-learn models into a portable format. Use it if you need to deploy scikit-learn models outside their native environment.
Install
skl2onnx on PyPI
pip
pip install skl2onnxuv
uv add skl2onnxpoetry
poetry add skl2onnxInstalling skl2onnx
Before you install
Low friction install with only two runtime dependencies (onnx and scikit-learn). The package is actively maintained with a recent release and no known vulnerabilities.
License in practice
Apache License v2.0 is permissive, allowing use in commercial and private projects with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
pip install skl2onnx
from skl2onnx import to_onnx
clr = RandomForestClassifier()
clr.fit(X_train, y_train)
onx = to_onnx(clr, X[:1])
with open("model.onnx", "wb") as f:
f.write(onx.SerializeToString())
Verify before relying
- Whether all scikit-learn model types are supported or only a subset (documentation mentions 'Supported scikit-learn Models' page but list not provided)
- Performance improvement magnitude when using ONNX Runtime versus native scikit-learn inference
- Compatibility with custom scikit-learn estimators or only built-in models
- Whether external converters can be registered for models from libraries beyond scikit-learn
Package facts
| License | Apache License v2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — onnx, scikit-learn |
| Maintenance | actively maintained — 196 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,556,584/month — #3,002 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: skl2onnx-1.20.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
onnxmltoolsConverts machine learning models from multiple…
permissive · top 5,000 on PyPI
optimum-onnxExports Hugging Face transformer models to ONNX…
permissive · top 15,000 on PyPI
onnxONNX provides an open-source format and runtime…
permissive · top 5,000 on PyPI
onnx-weeklyonnx-weekly provides a Python package for…
permissive · top 15,000 on PyPI
onnxconverter-commonProvides common utilities and functions for…
permissive · top 5,000 on PyPI
onnxsimSimplifies ONNX neural network models by…
permissive · top 15,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
onnx2torchConverts ONNX models to PyTorch modules with a…
permissive · top 15,000 on PyPI
tf2onnxConverts TensorFlow, Keras, TensorFlow.js, and…
permissive · top 15,000 on PyPI
onnxruntime-gpuExecutes ONNX machine learning models on GPU…
permissive · top 5,000 on PyPI