BookmarkSubscribeRSS Feed

Ease Dependency Management for Python Models: Updates to Python-sasctl and SAS Container Runtime

Started 3 weeks ago by
Modified 3 weeks ago by
Views 251

Many data scientists love how easy it is to import the latest packages and tools in Python. But where you may find data scientists pip installing to their hearts content, you may also find the disgruntled engineer who has to put that model into production. Models are often trained in the development environment that has one version of Python with a set of versioned packages. Models are then deployed into the production environment. Problems arise if the production environment uses a different version of Python, is missing required packages, or uses different versions of the required packages. Additionally, errors caused by dependency mismatches don’t always clearly point to the root problem. Instead, you may see errors that reference unrecognized parameters in a function, missing parameters, or undeclared functions. Ask me how I know.

 

Today, many organizations maintain a set of standard Python environments for model training. This can help IT secure an organization’s Python usage to only pre-approved and validated packages, but it also helps engineering match the model’s dependencies in the production environment. With this, MLOps engineers can build a list of dependencies for putting a Python model into production, but a better solution would be to create that dependency list during model training, store it with the model’s assets, and then use the list to build an environment that matches the model for deployment.

 

Enter SAS Model Manger and our included tools python-sasctl and SAS Container Runtime. With the release of python-sasctl v1.11.6 and SAS Viya 2025.11, we’ve added two new features aimed at better python dependency management. First, we have enhanced our Python base container for SAS Container Runtime so that it can build to Python 3.9 – 3.13. We’ve also updated our python-sasctl function for generating requirements.

 

Generating Requirements

 

Data scientists training models in Python can use our open-source package, python-sasctl to prepare the model metadata, write the score code, and register the model into SAS Model Manager, all from their Jupyter notebook (or Python development tool of choice).

 

Python-sasctl collects a lot of rich data about the model to make deployment much easier. For example, the write_model_properties_json() function will automatically detect the version of Python you’re using and note that in the model properties. Additionally, the create_requirements_json() function will look at the packages and versions you’re currently using, determine what packages the model score code needs to run, and write a json file with the information for SAS Container Runtime to use. With this information in hand, SAS Model Manager can publish the model into a Python container that’s built to the model’s specifications.

 

But what if you’re deploying your Python model to another tool, like SAS Event Stream Processing, that needs the python requirements in a text file? In the latest python-sasctl release, the create_requirements_json function() now includes an optional parameter, create_requirements_txt, that when set to true will also generate a requirements.txt file for you. To generate a requirements.json and requirements.txt file for your model, point the model directory to the folder where you model files are stored, the file where you want the requirement files to be saved (can be the same directory), and run the function.

 

MODEL_DIR = PATH.CWD() / "MY/MODELS/FILES"
FILE_DIR = PATH.CWD() / "MY/MODELS/FILES" 
PZMM.JSONFILES.CREATE_REQUIREMENTS_JSON(MODEL_DIR, FILE_DIR , CREATE_REQUIREMENTS_TXT=TRUE)

 

You can add the requirement files to your models files, which can be picked up by SAS Container Runtime or SAS Event Stream Processing.

 

Container Publishing

 

From SAS Model Manager, you can publish your Python model to container registries in Docker, Azure, AWS, and GCP using SAS Container Runtime. SAS Container Runtime uses the requirements.json file to install and import the model’s required packages. With SAS Viya 2025.11, the SAS Container Runtime now also pulls the Tool Version model property to determine which version of Python to use. Not all versions of Python are supported. Currently, our container only builds to Python 3.9 – 3.13 with plans to add the recently released Python 3.14. We do not plan to support earlier versions of Python as they have reached end of life and are no longer supported by Python.

 

To take advantage of the new container, use python-sasctl to automatically detect and document the Python version in the model properties as well as register the model into SAS Model Manager. You can also update the Tool Version model property manually to list your version of Python. If you don’t list a version, the default version will be used. If you don’t list a supported version of Python, you won’t be able to publish the model until you fix that field.

 

To learn more, check out this demo:

 

You can also specify a Python version for deploying decisioning flows from SAS Intelligent Decisioning into container destinations. From the properties tab in a decision flow, a user can select to use Python 3.11 or Python 3.12, with more Python versions coming soon. Note that SAS Intelligent Decisioning can support multiple Python models or code files, so if models imported into a decision flow from SAS Model Manager have a different Python version selected, a warning message will appear during the Validate phase, allowing you to reconcile versions for optimal decision flow execution

 

Conclusion

 

SophiaRowland_0-1764599834478.png

 

 

Our next planned enhancement to the process is to add support for Python 3.14 into our Python base container, but what would you like to see next for SAS Model Manager and Python? Let us know in the comments!

 

Want to learn more? Check out these resources:

Contributors
Version history
Last update:
3 weeks ago
Updated by:

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

SAS AI and Machine Learning Courses

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.

Get started

Article Labels
Article Tags