azure-sdk-for-python: typing.Annotated used in invalid context and raises error on python 3.13
Python 3.13 will be released in early October. We tested libraries against the final 3.13 release candidate in this PR: https://github.com/Azure/azure-sdk-for-python/pull/37508
With running 3.13, azure-ai-ml raises an error due to how typing.Annotated is used in the utils.py file:
File "/mnt/vss/_work/1/s/sdk/ml/azure-ai-ml/.tox/depends/lib/python3.13/site-packages/azure/ai/ml/_schema/pipeline/component_job.py", line 27, in <module>
from ...entities._inputs_outputs import Input
File "/mnt/vss/_work/1/s/sdk/ml/azure-ai-ml/.tox/depends/lib/python3.13/site-packages/azure/ai/ml/entities/_inputs_outputs/__init__.py", line 57, in <module>
from .enum_input import EnumInput
File "/mnt/vss/_work/1/s/sdk/ml/azure-ai-ml/.tox/depends/lib/python3.13/site-packages/azure/ai/ml/entities/_inputs_outputs/enum_input.py", line 10, in <module>
from .input import Input
File "/mnt/vss/_work/1/s/sdk/ml/azure-ai-ml/.tox/depends/lib/python3.13/site-packages/azure/ai/ml/entities/_inputs_outputs/input.py", line 25, in <module>
from .utils import _get_param_with_standard_annotation, _remove_empty_values
File "/mnt/vss/_work/1/s/sdk/ml/azure-ai-ml/.tox/depends/lib/python3.13/site-packages/azure/ai/ml/entities/_inputs_outputs/utils.py", line 28, in <module>
Annotation: TypeAlias = Union[str, Type, Annotated, None] # type: ignore
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/typing.py", line 432, in inner
return func(*args, **kwds)
File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/typing.py", line 576, in __getitem__
return self._getitem(self, parameters)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/typing.py", line 789, in Union
parameters = tuple(_type_check(p, msg) for p in parameters)
File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/typing.py", line 789, in <genexpr>
parameters = tuple(_type_check(p, msg) for p in parameters)
~~~~~~~~~~~^^^^^^^^
File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/typing.py", line 200, in _type_check
raise TypeError(f"Plain {arg} is not valid as type argument")
TypeError: Plain typing.Annotated is not valid as type argument
It would be good to fix this promptly in case there are other issues with 3.13.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 17 (9 by maintainers)
update, been hitting this issue for a while now.
@pdhotems happy to sync offline as we’re all FTE with @kristapratico . Azure SDK guidelines are quite clear that any SDK supports new version of Python immediately at their release, and strong effort needs to be made to be sure customers are not prevented to use the Python version they want. This issue needs to stay open, and I’d like a plan from you to solve that issue asap.
CC @rohit-ganguly
Yes azure-ai-ml starts supporting py3.13. However if you are using mount (azureml-dataprep-rslex), you have to use py3.12 or below version only.
I believe I’m having the same issue with Azure CLI and Python 3.13 (Fedora 41):
we just hit this issue today with python 3.13 which is now default in conda create - would be great if it could be fixed
azure-ai-ml library have hard dependency on azureml-dataprep-rslex and this package is not yet compatible with Python 3.13. Once this package will be upgraded to 3.13, we can start supporting py 3.13 for azure-ai-ml and ETA for upgradation is end of Jan 2025.