skillfed

sklearn2pmml

Python library for converting Scikit-Learn pipelines to PMML

sklearn2pmml v0.132.0 452.9K downloads/30d#6,579 on PyPI702
AGPL license GNU Affero General Public License (AGPL) version 3.0 Active released

What it is and what it does

sklearn2pmml is a Python wrapper around the JPMML-SkLearn Java library that converts trained estimators and pipelines into PMML, an XML-based standard for representing machine learning models. It works with native estimators as-is, and also provides a PMMLPipeline class that captures feature metadata, enables prediction post-processing, embeds verification data, and allows fine-grained PMML customization. The package includes a command-line interface and a library API, plus additional transformer and predictor classes for domain specification, feature engineering, and model combination.

The main use case is exporting trained models from Python for deployment in other systems that consume PMML. It handles pickling safely using a custom Java component rather than Python's built-in unpickler, making it suitable for untrusted pickle files. Runtime dependencies are standard (scikit-learn, pandas, joblib, dill), but Java 11 or newer must be present on the system.

Use it for:

  • Export a trained estimator to PMML for deployment in a non-Python scoring engine or business rules platform.
  • Preserve feature names and metadata in PMML when working with older scikit-learn versions that lack feature tracking.
  • Add prediction post-processing, verification data, and custom PMML edits to a pipeline before export using PMMLPipeline.
  • Convert pickled estimators from disk to PMML via the command-line interface without writing Python code.
  • Safely deserialize untrusted pickle files using sklearn2pmml's Java-based unpickler instead of Python's native pickle module.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts fitted Scikit-Learn pipelines to PMML (Predictive Model Markup Language) for deployment in other environments, supporting a wide range of estimators and transformers.

Yes, with conditions. Install if you need to export scikit-learn models to PMML for deployment outside Python and can accept the AGPL license terms. The package is actively maintained, has low install friction, and carries no known vulnerabilities. Do not install if your project is proprietary or closed-source without explicit AGPL compliance, or if Java 11 or newer is not available on your deployment system.

Install

sklearn2pmml on PyPI

pip

pip install sklearn2pmml

uv

uv add sklearn2pmml

poetry

poetry add sklearn2pmml

Installing sklearn2pmml

Before you install

Low friction: pure Python wheel with four common runtime dependencies (dill, joblib, pandas, scikit-learn). Requires Java 11 or newer on the system path; this is the only non-Python prerequisite. Package is actively maintained with a recent release.

License in practice

Licensed under GNU Affero General Public License (AGPL) version 3.0. Use is restricted to projects that can comply with copyleft obligations—derivative works and distributed modifications must be released under the same license. Not suitable for proprietary or closed-source applications without explicit permission.

Quickstart

pip install sklearn2pmml

from sklearn2pmml import sklearn2pmml
import joblib

estimator = joblib.load("model.pkl")
sklearn2pmml(estimator, "model.pmml")

Java 11 or newer must be installed and available on the system PATH.

Verify before relying

  • Whether all scikit-learn versions from 0.17 onward are truly compatible with a single package version.
  • Performance overhead of Java-based pickle deserialization versus native Python unpickler for large models.
  • Scope and completeness of supported estimator classes beyond the reference to JPMML-SkLearn features.

Package facts

License GNU Affero General Public License (AGPL) version 3.0 (agpl)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 4 — dill, joblib, pandas, scikit-learn
Maintenance actively maintained — 45 days since the last release
Last repo commit
First released
Downloads 452,877/month — #6,579 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sklearn2pmml-0.132.0-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonTopic :: Scientific/EngineeringTopic :: Software Development

Tags

scikit-learn to PMML conversionpipeline export formatPMML model serializationmachine learning model portabilitymodel to XML conversioncross-platform ML deploymentmodel interchange format
model-exportinteroperabilitypmml

More Software Development packages