skillfed

skl2onnx

Convert scikit-learn models to ONNX

skl2onnx v1.20.0 2.6M downloads/30d#3,002 on PyPI628
Permissive license Apache License v2.0 Active released

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 skl2onnx

uv

uv add skl2onnx

poetry

poetry add skl2onnx

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

scikit-learn to ONNX conversionsklearn model export ONNXconvert scikit-learn modelsONNX model deploymentmodel format conversionONNX runtime compatibilitymachine learning model export
model-exportml-deploymentinference-optimization

More Artificial Intelligence packages