Hi Nik Adlakha
The issue you're experiencing stems from a fundamental mismatch between your Python environments. While your main pipeline runs on Python 3.10, the AutoML regression job defaults to Python 3.9, causing dependency conflicts when loading the model.
First, create a dedicated environment for AutoML:
name: automl_environment
channels:
- conda-forge
dependencies:
- python=3.9
- mlflow
- scikit-learn
- cloudpickle
After that Update the Pipeline configuration
aml_env = Environment(name="automl_environment")
aml_env.python.version = "3.9"
train = regression(
experiment_name=customer_definition.experiment_name,
training_data=train_test_split_step.outputs.train_data,
compute=compute_name,
environment=aml_env,
outputs={"best_model": Output(type="mlflow_model")},
)
Finally, load the model with proper environment settings
model_config = {
"python_version": "3.9",
"pip_requirements": [
"mlflow==latest",
"scikit-learn==latest",
"cloudpickle==latest"
]
}
model = mlflow.pyfunc.load_model(model_uri=model_uri, python_env=model_config)
This will maintains separate environments while ensuring compatibility between your main pipeline and AutoML jobs. The key is keeping the AutoML environment isolated with Python 3.9 while allowing your main pipeline to continue running on Python 3.10.
Hope it Helps!
Thanks