Marshallow 4.0.0 update has broken azure.ai.ml MLClient
- Package - Azure.ai.ml
- Package Version - 1.26.2:
- OS - Any
- Python Version - 3.10
Describe the bug This bug causes a failure upon importing MLClient from azure.ai.ml. As can be seen from the stacktrace below, the bug clearly originates in Marshmallow (v4.0.0).
Stacktrace:
ImportError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from azure.ai.ml import MLClient
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/__init__.py:11
8 from typing import Any, Optional
10 # from .entities._builders.parallel_func import parallel
---> 11 from azure.ai.ml.entities._inputs_outputs import Input, Output
13 from ._ml_client import MLClient
14 from ._utils._logger_utils import initialize_logger_info
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/entities/__init__.py:18
15 from azure.ai.ml._restclient.v2022_10_01.models import CreatedByType
16 from azure.ai.ml._restclient.v2022_10_01_preview.models import UsageUnit
---> 18 from ._assets._artifacts._package.base_environment_source import BaseEnvironment
19 from ._assets._artifacts._package.inferencing_server import (
20 AzureMLBatchInferencingServer,
21 AzureMLOnlineInferencingServer,
(...)
24 TritonInferencingServer,
25 )
26 from ._assets._artifacts._package.model_configuration import ModelConfiguration
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/entities/_assets/_artifacts/_package/base_environment_source.py:10
7 from typing import Dict, Optional
9 from azure.ai.ml._restclient.v2023_08_01_preview.models import BaseEnvironmentId as RestBaseEnvironmentId
---> 10 from azure.ai.ml._schema.assets.package.base_environment_source import BaseEnvironmentSourceSchema
11 from azure.ai.ml._utils._experimental import experimental
12 from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/_schema/__init__.py:7
1 # ---------------------------------------------------------
2 # Copyright (c) Microsoft Corporation. All rights reserved.
3 # ---------------------------------------------------------
5 __path__ = __import__("pkgutil").extend_path(__path__, __name__)
----> 7 from ._data_import import DataImportSchema
8 from ._sweep import SweepJobSchema
9 from .assets.code_asset import AnonymousCodeAssetSchema, CodeAssetSchema
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/_schema/_data_import/__init__.py:7
1 # ---------------------------------------------------------
2 # Copyright (c) Microsoft Corporation. All rights reserved.
3 # ---------------------------------------------------------
5 __path__ = __import__("pkgutil").extend_path(__path__, __name__)
----> 7 from .data_import import DataImportSchema
9 __all__ = ["DataImportSchema"]
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/_schema/_data_import/data_import.py:7
1 # ---------------------------------------------------------
2 # Copyright (c) Microsoft Corporation. All rights reserved.
3 # ---------------------------------------------------------
5 from marshmallow import post_load
----> 7 from azure.ai.ml._schema.core.fields import NestedField
8 from azure.ai.ml._schema.job.input_output_entry import DatabaseSchema, FileSystemSchema
9 from azure.ai.ml._utils._experimental import experimental
File /anaconda/envs/myenv1/lib/python3.10/site-packages/azure/ai/ml/_schema/core/fields.py:20
18 from marshmallow.exceptions import ValidationError
19 from marshmallow.fields import Field, Nested
---> 20 from marshmallow.utils import FieldInstanceResolutionError, from_iso_datetime, resolve_field_instance
22 from ..._utils._arm_id_utils import AMLVersionedArmId, is_ARM_id_for_resource, parse_name_label, parse_name_version
23 from ..._utils._experimental import _is_warning_cached
ImportError: cannot import name 'FieldInstanceResolutionError' from 'marshmallow.utils' (/anaconda/envs/myenv1/lib/python3.10/site-packages/marshmallow/utils.py)
This is similar to the issue raised earlier, https://github.com/Azure/azure-sdk-for-python/issues/39039
The latest Azure CLI is broken if you install the "ml" extension now.
$ az version
{
"azure-cli": "2.71.0",
"azure-cli-core": "2.71.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
}
$ az extension add -n ml -y
$ az extension list
cannot import name 'FieldInstanceResolutionError' from 'marshmallow.utils' (/home/azureuser/.azure/cliextensions/ml/marshmallow/utils.py)
[
{
"experimental": false,
"extensionType": "whl",
"name": "ml",
"path": "/home/azureuser/.azure/cliextensions/ml",
"preview": false,
"version": "2.36.3"
}
]
$ az ml -h
cannot import name 'FieldInstanceResolutionError' from 'marshmallow.utils' (/home/azureuser/.azure/cliextensions/ml/marshmallow/utils.py)
'ml' is misspelled or not recognized by the system.
Examples from AI knowledge base:
az extension add --name anextension
Add extension by name
az extension list-available
List all publicly available extensions
https://docs.microsoft.com/en-US/cli/azure/extension#az_extension_add
Read more about the command in reference docs
same error for me even with ml extension version "2.33.1"
{ "azure-cli": "2.71.0", "azure-cli-core": "2.71.0", "azure-cli-telemetry": "1.1.0", "extensions": { "azure-devops": "1.0.1" } } cannot import name 'FieldInstanceResolutionError' from 'marshmallow.utils' (/opt/az/azcliextensions/ml/marshmallow/utils.py) [ { "experimental": false, "extensionType": "whl", "name": "azure-devops", "path": "/opt/az/azcliextensions/azure-devops", "preview": false, "version": "1.0.1" }, { "experimental": false, "extensionType": "whl", "name": "ml", "path": "/opt/az/azcliextensions/ml", "preview": false, "version": "2.33.1"
See also https://github.com/Azure/azure-cli-extensions/issues/8667
i would note that (depending on you dependencies) you can temporarily fix this in python-world by including marshmallow<4.0.0 in your requirements files
Thanks for reporting the issue.
We just shipped azure-ai-ml 1.26.3 which added the upper bound check for marshmallow.
Please use the latest one.
Hi @jonathanreichhealthscope. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
Thanks for reporting the issue.
We just shipped azure-ai-ml 1.26.3 which added the upper bound check for marshmallow.
Please use the latest one.
Thanks for that. Appreciate the promptness. Closing this issue.
I had same issue but with Mac OS. Able to get it fixed by workaround posted by @tgolly here
Model Name: MacBook Pro
Model Identifier: Mac14,9
Model Number: Z17G000NVLL/A
Chip: Apple M2 Pro
Total Number of Cores: 10 (6 performance and 4 efficiency)
Memory: 32 GB
System Firmware Version: 11881.101.1
OS Loader Version: 11881.101.1
az version { "azure-cli": "2.71.0", "azure-cli-core": "2.71.0", "azure-cli-telemetry": "1.1.0", "extensions": { "k8s-extension": "1.6.4", "ml": "2.36.3", "resource-graph": "2.1.1", "terraform": "1.0.0b1" } }
az ml -h returns below error.
cannot import name 'FieldInstanceResolutionError' from 'marshmallow.utils' (/Users/
Examples from AI knowledge base: az extension add --name anextension Add extension by name
az extension list-available List all publicly available extensions
https://docs.microsoft.com/en-US/cli/azure/extension#az_extension_add Read more about the command in reference docs