Skip to content

https://raw.githubusercontent.com/MicrosoftLearning/mslearn-mlops/refs/heads/main/docs/01-experiment-evaluate-models.md - jpynb issue #42

@SkillableKarl

Description

@SkillableKarl

Exercise # 'Find the best classification model with Azure Machine Learning' - Task # 'Track model training with MLflow' - Step #4
Issue Identified: Received an error while running the below code block. Had to update the mlflow then restart the kernel. Ran this lab twice and received the same error.

Even after attempting to install mlflow/restart kernel, we are blocked:

Image

Extended error:

Name: azure-ai-ml
Version: 1.32.0
Summary: Microsoft Azure Machine Learning Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python
Author: Microsoft Corporation
Author-email: azuresdkengsysadmins@microsoft.com
License: MIT License
Location: /anaconda/envs/azureml_py38/lib/python3.10/site-packages
Requires: azure-common, azure-core, azure-mgmt-core, azure-monitor-opentelemetry, azure-storage-blob, azure-storage-file-datalake, azure-storage-file-share, colorama, isodate, jsonschema, marshmallow, pydash, pyjwt, pyyaml, strictyaml, tqdm, typing-extensions
Required-by:
Note: you may need to restart the kernel to use updated packages.
Found the config file in: /config.json
Class DeploymentTemplateOperations: This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
WARNING: Package(s) not found: mlflow
Note: you may need to restart the kernel to use updated packages.
Reading data...
PatientID Pregnancies PlasmaGlucose DiastolicBloodPressure TricepsThickness SerumInsulin BMI DiabetesPedigree Age Diabetic
0 1354778 0 171 80 34 23 43.509726 1.213191 21 0
1 1147438 8 92 93 47 36 21.240576 0.158365 23 0
2 1640031 7 115 47 52 35 41.511523 0.079019 23 0
3 1883350 9 103 78 25 304 29.582192 1.282870 43 1
4 1424119 1 85 59 27 35 42.604536 0.549542 22 0
Splitting data...
2026/03/19 13:06:58 INFO mlflow.tracking.fluent: Experiment with name 'mlflow-experiment-diabetes' does not exist. Creating a new experiment.
<Experiment: artifact_location='', creation_time=1773925618700, experiment_id='ae258766-1d9f-4054-9aa3-36d749fad0ef', last_update_time=None, lifecycle_stage='active', name='mlflow-experiment-diabetes', tags={}>
2026/03/19 13:07:13 WARNING mlflow.utils.autologging_utils: Encountered unexpected error during sklearn autologging: ArtifactRepository.init() takes 2 positional arguments but 4 were given
🏃 View run khaki_picture_0xc9b2gl at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef/runs/3d954d8e-e31b-420b-ad2e-f84576449652
🧪 View experiment at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef
🏃 View run cool_machine_0xb197xb at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef/runs/ec63473d-fae7-49d9-b98b-ea9a45da8683
🧪 View experiment at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef
🏃 View run neat_shirt_fwwnwz9r at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef/runs/3f797955-5556-4714-bca3-fcfaf677af85
🧪 View experiment at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef
🏃 View run dreamy_screw_8j0jfz0y at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef/runs/2dfd5d15-c64d-4234-98df-fc33284a0cd4
🧪 View experiment at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef
🏃 View run shy_fig_93509rjv at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef/runs/792176d0-e63c-465d-9ec7-7947d863d37e
🧪 View experiment at: https://centralus.api.azureml.ms/mlflow/v2.0/subscriptions/54114433-9e99-4ca7-97ad-dbf1057f84f7/resourceGroups/rg-ai300-l60133264/providers/Microsoft.MachineLearningServices/workspaces/mlw-ai300-l60133264/#/experiments/ae258766-1d9f-4054-9aa3-36d749fad0ef

TypeError Traceback (most recent call last)
Cell In[14], line 28
26 mlflow.log_param("estimator", "DecisionTreeClassifier")
27 mlflow.log_metric("Accuracy", acc)
---> 28 mlflow.log_artifact("ROC-Curve.png")

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/mlflow/tracking/fluent.py:1179, in log_artifact(local_path, artifact_path, run_id)
1149 """
1150 Log a local file or directory as an artifact of the currently active run. If no run is
1151 active, this method will create a new active run.
(...)
1176 mlflow.log_artifact(path)
1177 """
1178 run_id = run_id or _get_or_start_run().info.run_id
-> 1179 MlflowClient().log_artifact(run_id, local_path, artifact_path)

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/mlflow/tracking/client.py:2379, in MlflowClient.log_artifact(self, run_id, local_path, artifact_path)
2375 if run_id.startswith(TRACE_REQUEST_ID_PREFIX):
2376 raise MlflowException(
2377 f"Invalid run id: {run_id}. log_artifact run id must map to a valid run."
2378 )
-> 2379 self._tracking_client.log_artifact(run_id, local_path, artifact_path)

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/mlflow/tracking/_tracking_service/client.py:927, in TrackingServiceClient.log_artifact(self, run_id, local_path, artifact_path)
918 def log_artifact(self, run_id, local_path, artifact_path=None):
919 """
920 Write a local file or directory to the remote artifact_uri. 921 (...) 925 artifact_path: If provided, the directory in artifact_uri to write to.
926 """
--> 927 artifact_repo = self._get_artifact_repo(run_id)
928 if os.path.isdir(local_path):
929 dir_name = os.path.basename(os.path.normpath(local_path))

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/mlflow/tracking/_tracking_service/client.py:910, in TrackingServiceClient._get_artifact_repo(self, run_id)
906 run = self.get_run(run_id)
907 artifact_uri = add_databricks_profile_info_to_artifact_uri(
908 run.info.artifact_uri, self.tracking_uri
909 )
--> 910 artifact_repo = get_artifact_repository(artifact_uri)
911 # Cache the artifact repo to avoid a future network call, removing the oldest
912 # entry in the cache if there are too many elements
913 if len(utils._artifact_repos_cache) > 1024:

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/mlflow/store/artifact/artifact_repository_registry.py:133, in get_artifact_repository(artifact_uri)
120 def get_artifact_repository(artifact_uri: str) -> ArtifactRepository:
121 """
122 Get an artifact repository from the registry based on the scheme of artifact_uri
123
(...)
131 requirements.
132 """
--> 133 return _artifact_repository_registry.get_artifact_repository(artifact_uri)

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/mlflow/store/artifact/artifact_repository_registry.py:77, in ArtifactRepositoryRegistry.get_artifact_repository(self, artifact_uri)
72 if repository is None:
73 raise MlflowException(
74 f"Could not find a registered artifact repository for: {artifact_uri}. "
75 f"Currently registered schemes are: {list(self._registry.keys())}"
76 )
---> 77 return repository(artifact_uri)

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/azureml/mlflow/entry_point_loaders.py:24, in azureml_artifacts_builder(artifact_uri, tracking_uri, registry_uri)
14 """Create an artifact repository for AzureMLflow.
15
16 :param artifact_uri: A URI where artifacts are stored.
(...)
21 :type registry_uri: str
22 """
23 from azureml.mlflow._store.artifact.artifact_repo import AzureMLflowArtifactRepository
---> 24 return AzureMLflowArtifactRepository(artifact_uri, tracking_uri=tracking_uri, registry_uri=registry_uri)

File /anaconda/envs/azureml_py38/lib/python3.10/site-packages/azureml/mlflow/_store/artifact/artifact_repo.py:42, in AzureMLflowArtifactRepository.init(self, artifact_uri, tracking_uri, registry_uri)
27 def init(self, artifact_uri, tracking_uri=None, registry_uri=None):
28 """
29 Construct an AzureMLflowArtifactRepository object.
30
(...)
40 :type registry_uri: str
41 """
---> 42 super().init(artifact_uri, tracking_uri, registry_uri)
43 self.artifacts = get_artifact_repository_client(artifact_uri)

TypeError: ArtifactRepository.init() takes 2 positional arguments but 4 were given

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions