Data scientists using Python often have their favorite programming environment and set of packages for cleaning data and developing models. These data scientists are hard at work developing machine learning models, but how do these models fit into overarching business processes and needs? Enter SAS Model Manager: a leader in MLOps. SAS Model Manager helps organizations manage, audit, deploy, monitor, validate, and search their models. And yes, this includes Python models. Data scientists using Python lean on the SASCTL package to interact with SAS Model Manager and ensure that their models are included within a wider ModelOps and MLOps strategy.
SASCTL is an open source package developed and maintained by SAS that allows data scientists to interact with SAS Model Manager using Python. Using SASCTL, these data scientists can register their models and metadata directly from their favorite programming environment! This saves data scientists and IT time and headaches. SASCTL also allows data scientists to automatically generate score code for their models (because as data scientists know, training code does not equal score code) and much more. With the v1.8 release of SASCTL, data scientists can quickly save environment requirements for their Python models as well as select which project version their model is registered to.
Many organizations have difficulty maintaining Python development and production environments. Often there is a mismatch between what a data scientist is using to develop their model and what is available within production. This mismatch can prevent a model from running within production. Using containers, IT can create lightweight environments that match the development environment, but how do we ensure that the container has everything it needs?
SAS Model Manager uses a JSON-formatted file stored with the model’s metadata called a Requirements file. When publishing a Python model to a container, this file specifies which packages and versions to install within that container so the model has everything it needs to run. With the latest release of SASCTL, a new function is available for generating this Requirements file. This function takes the folder of modeling assets, including the model score code and pickle file, generated by SASCTL as it’s input.
requirements_json = pzmm.JSONFiles.create_requirements_json(model_dir)
For a decision tree classifier, our requirements would look like the following:
[
{
"command": "pip install sklearn",
"step": "install sklearn"
},
{
"command": "pip install numpy==1.23.5",
"step": "install numpy"
},
{
"command": "pip install pandas==1.5.3",
"step": "install pandas"
}
]
To be effective, this function needs to run in the same environment the model was developed in and may require a manual review before use to ensure that it has the correct install name and package version. Unfortunately, some Python packages use a different name for install and import, such as the popular Scikit–Learn package. We can easily edit and amend our requirement files to ensure its accuracy.
scikit_learn_install = {
"command": "pip install scikit-learn==1.2.0",
"step": "install scikit-learn"
}
requirements_json[0].update(scikit_learn_install)
print(json.dumps(r
with open(Path(model_dir) / "requirements.json", "w") as req_file:
req_file.write(json.dumps(requirements_json, indent=4))
Our new file would look like this:
[
{
"command": "pip install scikit-learn==1.2.0",
"step": "install scikit-learn"
},
{
"command": "pip install numpy==1.23.5",
"step": "install numpy"
},
{
"command": "pip install pandas==1.5.3",
"step": "install pandas"
}
]
Did you know you can make requests for new SASCTL features through our GitHub page? By submitting an issue with the Enhancements tag, you can let our team know what you want to see in SASCTL next! Our next enhancement came directly from a user’s request through our GitHub page.
SAS Model Manager supports multiple project versions and now when registering a model using SASCTL, data scientists can select which project version for model import. Within the pzmmImportModel() function, a data scientist can leverage the projectVersion parameter to pass the name of the project version they would like model to go. The model is registered to the latest project version by default.
I = pzmm.ImportModel()
I.pzmmImportModel(model-output-path, model-name, project-name, input-df, target-df, predict-method, projectVersion='Version 2')
These updates to SASCTL gives more functionality to data scientists working in Python to help improve decisioning making through analytics!
Analyst firm, IDC, recently praised SAS Model Manager for our support of a wide variety of languages and platforms. To learn why, check out these resources!
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.