How to fix "Model registry functionality is unavailable; got unsupported URI"

Becaye Balde 20 Reputation points
2023-08-24T22:44:01.2233333+00:00

Hi,

I am trying to run a script using a command job from Azure Machine Learning Workspace. Everything wroked perfectly until I added mlflow.log() to my code. Now I get an exeption:

mlflow.tracking.registry.UnsupportedModelRegistryStoreURIException:  Model registry functionality is unavailable; got unsupported URI 'azureml://canadacentral.api.azureml.ms/mlflow/v1.0/subscriptions/CONFIDENTIAL_INFO_HERE/Microsoft.MachineLearningServices/workspaces/' for model registry data storage.

Here is my script:

%%writefile {preprocessing_src_dir}/preprocess.py

"""
Preprocess and save the data.
"""


import pandas as pd
from preprocessor import Preprocessor
import yaml
import argparse
import mlflow



def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("--input_data", type=str, help="path to input data")
    parser.add_argument("--output_data", type=str, help="path to output data")

    return parser.parse_args()


def main(args):
	# Some code

    # Load the data
    df = pd.read_csv(args.input_data, encoding='latin-1', skiprows=2)

    # -------------------
    # Preprocess the data
    # -------------------
       
  	# Save the preprocessed data
    df.to_parquet(args.output_data, index=False)

    # Log the preprocessing steps and the data shape
    mlflow.log_param("features_to_drop", features_to_drop)
    mlflow.log_param("correlated_features_to_drop", corr_features)
    mlflow.log_param("dates_features", dates_features)
    mlflow.log_param("missing_features", missing_features)
    mlflow.log_param("values_to_drop", values_to_drop)
    mlflow.log_param("categories_to_merge", categories_to_merge)
    mlflow.log_param("features_to_rename", features_to_rename)

    mlflow.log_metric("n_samples", df.shape[0])
    mlflow.log_metric("n_features", df.shape[1])

    print("Preprocessing done!")
        

if __name__ == "__main__":
    print("Running script to preprocess the data...")

    mlflow.start_run()

    args = parse_args()
    main(args)

    mlflow.end_run()


Any help would be much appreciated.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,897 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Becaye Balde 20 Reputation points
    2023-08-29T15:38:01.73+00:00

    Yes you were right! Sorry for the late reply after going through thousands of repositories, I noticed that I missed the azure-mlflow package in my coda:

    channels:
      - defaults
      - anaconda
      - conda-forge
    dependencies:
      - python=3.10
      - pip==23.1.2
      - matplotlib==3.7.1
      - seaborn==0.12.2
      - scikit-learn==1.3.0
      - joblib==1.2.0
      - py-xgboost==1.7.3
      - pyyaml==6.0
      - pyarrow==12.0.1
      - fastparquet==2023.4.0
      - imbalanced-learn==0.10.1
      - shap==0.42.1
      - black==23.3.0
      - pip:
        - pandas==2.0.2
        - optuna==3.2.0
        - mlflow==2.4.0
        - azureml-mlflow==1.53.0
        - azure-ai-ml==1.9.0
    

    Thank you a lot tho. My issue has been solved.

    2 people found this answer helpful.

  2. Ramr-msft 17,736 Reputation points
    2023-08-25T10:10:32.93+00:00

    @Becaye Balde Thank you for posting your question, Can you please share the complete notebook. This error is occurring because you are trying to use the model registry functionality of MLflow, but the URI you provided is not supported.

    To resolve this issue, you need to ensure that you are using a supported URI for the model registry. According to the Azure documentation, model registries can't operate at the same time in Azure Databricks and Azure Machine Learning. Either one or the other has to be used.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.