Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az aks: No module named 'azure.mgmt.containerservice.v2021_10_01' #21252

Closed
tux3 opened this issue Feb 11, 2022 · 7 comments
Closed

az aks: No module named 'azure.mgmt.containerservice.v2021_10_01' #21252

tux3 opened this issue Feb 11, 2022 · 7 comments
Assignees
Labels
AKS az aks/acs/openshift customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team.

Comments

@tux3
Copy link

tux3 commented Feb 11, 2022

This is autogenerated. Please review and update as needed.

Describe the bug

See traceback, all az aks subcommands fail immediately.

Command Name
az aks

Errors:

The command failed with an unexpected error. Here is the traceback:
No module named 'azure.mgmt.containerservice.v2021_10_01'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 583, in execute
    parsed_args = self.parser.parse_args(args)
  File "/usr/lib/python3/dist-packages/knack/parser.py", line 261, in parse_args
    return super().parse_args(args)
  File "/usr/lib/python3.9/argparse.py", line 1836, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3/dist-packages/azure/cli/core/parser.py", line 284, in parse_known_args
    self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
  File "/usr/lib/python3.9/argparse.py", line 1869, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.9/argparse.py", line 2081, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "/usr/lib/python3.9/argparse.py", line 2037, in consume_positionals
    take_action(action, args)
  File "/usr/lib/python3.9/argparse.py", line 1946, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.9/argparse.py", line 1225, in __call__
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
  File "/usr/lib/python3/dist-packages/azure/cli/core/parser.py", line 284, in parse_known_args
    self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
  File "/usr/lib/python3.9/argparse.py", line 1869, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.9/argparse.py", line 2106, in _parse_known_args
    self.error(_('the following arguments are required: %s') %
  File "/usr/lib/python3/dist-packages/azure/cli/core/parser.py", line 160, in error
    recommender.set_help_examples(self.get_examples(self.prog))
  File "/usr/lib/python3/dist-packages/azure/cli/core/parser.py", line 201, in get_examples
    return self.cli_help.get_examples(command,
  File "/usr/lib/python3/dist-packages/azure/cli/core/_help.py", line 192, in get_examples
    else self.group_help_cls(self, delimiters, parser)
  File "/usr/lib/python3/dist-packages/knack/help.py", line 253, in __init__
    child.load(options)
  File "/usr/lib/python3/dist-packages/azure/cli/core/_help.py", line 303, in load
    loader.versioned_load(self, options)
  File "/usr/lib/python3/dist-packages/azure/cli/core/_help_loaders.py", line 154, in versioned_load
    super(CliHelpFile, help_obj).load(parser)  # pylint:disable=bad-super-call
  File "/usr/lib/python3/dist-packages/knack/help.py", line 198, in load
    description = getattr(options, 'description', None)
  File "/usr/lib/python3/dist-packages/knack/parser.py", line 241, in __getattribute__
    self.description = self._description() \
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 133, in description_loader
    op = self.get_op_handler(self.op_path)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.containerservice.v2021_10_01'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Install from DEB
  • az aks

Expected Behavior

No traceback.

Environment Summary

Linux-5.16.0-1-amd64-x86_64-with-glibc2.33, Debian GNU/Linux bookworm/sid
Python 3.9.10
Installer: DEB

azure-cli 2.33.0

Extensions:
serial-console 0.1.1
azure-devops 0.23.0

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. AKS az aks/acs/openshift CXP Attention This issue is handled by CXP team. Auto-Assign Auto assign by bot and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Feb 11, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 11, 2022

route to CXP team

@yonzhan yonzhan removed the Auto-Assign Auto assign by bot label Feb 11, 2022
@SaurabhSharma-MSFT SaurabhSharma-MSFT self-assigned this Feb 11, 2022
@SaurabhSharma-MSFT
Copy link
Member

@tux3 I am not seeing any error. Can you please run az aks addon list-available and provide the error message and trace.

Thanks
Saurabh

@tux3
Copy link
Author

tux3 commented Feb 12, 2022

@SaurabhSharma-MSFT

Sure thing. I have the same error on my desktop and laptop, both running Debian. I've installed the CLI using these deb packages.

$ az aks addon list-available
The command requires the extension aks-preview. Do you want to install it now? The command will continue to run after the extension is installed. (Y/n):
Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
The installed extension 'aks-preview' is in preview.
[
  {
    "description": "- configure ingress with automatic public DNS name creation",
    "name": "http_application_routing"
  },
  {
    "description": "- turn on Log Analytics monitoring. Uses the Log Analytics Default Workspace if it exists, else creates one. Specify \"--workspace-resource-id\" to use an existing workspace.\nIf monitoring addon is enabled --no-wait argument will have no effect.",
    "name": "monitoring"
  },
  {
    "description": "- enable AKS Virtual Node. Requires --aci-subnet-name to provide the name of an existing subnet for the Virtual Node to use.\naci-subnet-name must be in the same vnet which is specified by --vnet-subnet-id (required as well).",
    "name": "virtual-node"
  },
  {
    "description": "- enable Azure policy. The Azure Policy add-on for AKS enables at-scale enforcements and safeguards on your clusters in a centralized, consistent manner.\nLearn more at aka.ms/aks/policy.",
    "name": "azure-policy"
  },
  {
    "description": "- n/a",
    "name": "kube-dashboard"
  },
  {
    "description": "- enable Application Gateway Ingress Controller addon (PREVIEW).",
    "name": "ingress-appgw"
  },
  {
    "description": "- enable Open Service Mesh addon (PREVIEW).",
    "name": "open-service-mesh"
  },
  {
    "description": "- enable confcom addon, this will enable SGX device plugin by default (PREVIEW).",
    "name": "confcom"
  },
  {
    "description": "- enable GitOps (PREVIEW).",
    "name": "gitops"
  },
  {
    "description": "- enable Azure Keyvault Secrets Provider addon (PREVIEW).",
    "name": "azure-keyvault-secrets-provider"
  }
]

@SaurabhSharma-MSFT
Copy link
Member

@tux3 Thanks for sharing. So the above cmdlet worked. Can you please share the subcommand like az aks create -g MyResourceGroup -n MyManagedCluster that failed in your Debian environment?

@tux3
Copy link
Author

tux3 commented Feb 12, 2022

@SaurabhSharma-MSFT
If I run az aks by itself, it fails as shown in the first post.

Other commands that fail include az aks get-credentials --admin -n foo -g bar:

$ az aks get-credentials --admin -n foo -g bar
The command failed with an unexpected error. Here is the traceback:
API version 2021-10-01 does not have operation group 'managed_clusters'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 112, in handler
    client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/acs/_client_factory.py", line 22, in cf_managed_clusters
    return get_container_service_client(cli_ctx).managed_clusters
  File "/usr/lib/python3/dist-packages/azure/mgmt/containerservice/_container_service_client.py", line 404, in managed_clusters
    raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version))
ValueError: API version 2021-10-01 does not have operation group 'managed_clusters'
To open an issue, please run: 'az feedback'

az aks list fails with the same error:

$ az aks list
The command failed with an unexpected error. Here is the traceback:
API version 2021-10-01 does not have operation group 'managed_clusters'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 112, in handler
    client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/acs/_client_factory.py", line 22, in cf_managed_clusters
    return get_container_service_client(cli_ctx).managed_clusters
  File "/usr/lib/python3/dist-packages/azure/mgmt/containerservice/_container_service_client.py", line 404, in managed_clusters
    raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version))
ValueError: API version 2021-10-01 does not have operation group 'managed_clusters'
To open an issue, please run: 'az feedback'

On my Debian desktop, start and stop seem to work. However on my laptop I also see a similar error:

$ az aks start -g foo -n bar
The command failed with an unexpected error. Here is the traceback:
No module named 'azure.mgmt.containerservice.v2021_10_01'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 556, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 515, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 313, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.containerservice.v2021_10_01'
To open an issue, please run: 'az feedback'

On both my Debian machines, az aks by itself is the simplest reproducer for me.

@SaurabhSharma-MSFT
Copy link
Member

@tux3 I am not able to reproduce this issue in my environment. As mentioned in another GitHub issue can you please follow https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt to install Azure CLI on stable/GA versions of Debian, like 11 Bullseye, instead of Sid.

Ref: https://wiki.debian.org/DebianUnstable

Sid is forever doomed to being unstable.

@tux3
Copy link
Author

tux3 commented Feb 17, 2022

@SaurabhSharma-MSFT Noted, thanks. While I used the instructions from this page (the curl | bash script), I'd missed the note that says Debian testing is unsupported.

@tux3 tux3 closed this as completed Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS az aks/acs/openshift customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team.
Projects
None yet
Development

No branches or pull requests

3 participants