MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.29k stars 21.48k forks source link

Error importing AnomalyDetectorClient #69853

Closed vscherbinin closed 3 years ago

vscherbinin commented 3 years ago

Hi guys,

import os from azure.ai.anomalydetector import AnomalyDetectorClient

gives


TypeError Traceback (most recent call last)

in () 1 import os ----> 2 from azure.ai.anomalydetector import AnomalyDetectorClient c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\__init__.py in () 7 # -------------------------------------------------------------------------- 8 ----> 9 from ._anomaly_detector_client import AnomalyDetectorClient 10 from ._version import VERSION 11 c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\_anomaly_detector_client.py in () 19 20 from ._configuration import AnomalyDetectorClientConfiguration ---> 21 from .operations import AnomalyDetectorClientOperationsMixin 22 from . import models 23 c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\operations\__init__.py in () 7 # -------------------------------------------------------------------------- 8 ----> 9 from ._anomaly_detector_client_operations import AnomalyDetectorClientOperationsMixin 10 11 __all__ = [ c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\operations\_anomaly_detector_client_operations.py in () 13 from azure.core.pipeline.transport import HttpRequest, HttpResponse 14 ---> 15 from .. import models 16 17 if TYPE_CHECKING: c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\models\__init__.py in () 8 9 try: ---> 10 from ._models_py3 import AnomalyDetectorError 11 from ._models_py3 import ChangePointDetectRequest 12 from ._models_py3 import ChangePointDetectResponse c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\models\_models_py3.py in () 13 import msrest.serialization 14 ---> 15 from ._anomaly_detector_client_enums import * 16 17 c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\site-packages\azure\ai\anomalydetector\models\_anomaly_detector_client_enums.py in () 27 28 ---> 29 class AnomalyDetectorErrorCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 30 """The error code. 31 """ c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\enum.py in __prepare__(metacls, cls, bases) 117 enum_dict = _EnumDict() 118 # inherit previous flags and _generate_next_value_ function --> 119 member_type, first_enum = metacls._get_mixins_(bases) 120 if first_enum is not None: 121 enum_dict['_generate_next_value_'] = getattr(first_enum, '_generate_next_value_', None) c:\users\vscherbinin\appdata\local\programs\python\python36-32\lib\enum.py in _get_mixins_(bases) 437 # base is now the last base in bases 438 if not issubclass(base, Enum): --> 439 raise TypeError("new enumerations must be created as " 440 "`ClassName([mixin_type,] enum_type)`") 441 TypeError: new enumerations must be created as `ClassName([mixin_type,] enum_type)` How can this be fixed? --- #### Document Details ⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.* * ID: 884b5e88-48eb-c3ad-1995-7cd87339783b * Version Independent ID: e06cfd58-46d0-200a-5967-c6a1a7276997 * Content: [Quickstart: Anomaly detection using the Anomaly Detector client library - Azure Cognitive Services](https://docs.microsoft.com/en-us/azure/cognitive-services/anomaly-detector/quickstarts/client-libraries?pivots=programming-language-python&tabs=windows) * Content Source: [articles/cognitive-services/Anomaly-Detector/quickstarts/client-libraries.md](https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/cognitive-services/Anomaly-Detector/quickstarts/client-libraries.md) * Service: **cognitive-services** * Sub-service: **anomaly-detector** * GitHub Login: @mrbullwinkle * Microsoft Alias: **mbullwin**
ram-msft commented 3 years ago

@vscherbinin Thanks for the question. We are investigating the issue and will update you shortly.

ram-msft commented 3 years ago

@vscherbinin Thanks, We are able to successfully import AnomalyDetectorClient. Can you please install Anomaly Detector Client Library for Python using the following. pip install azure-ai-anomalydetector.

vscherbinin commented 3 years ago

Thank you, Ram. I've done that, the issue is the same, fixed it for now as below, this did the trick for now:

class AnomalyDetectorErrorCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):

class AnomalyDetectorErrorCodes(str, Enum):

"""The error code.
"""

INVALID_CUSTOM_INTERVAL = "InvalidCustomInterval"
BAD_ARGUMENT = "BadArgument"
ram-msft commented 3 years ago

@vscherbinin Thanks, We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.