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

No module named 'azure.keyvault.v7_0' after CLI Installation #26835

Closed
muonmax opened this issue Jul 6, 2023 · 6 comments
Closed

No module named 'azure.keyvault.v7_0' after CLI Installation #26835

muonmax opened this issue Jul 6, 2023 · 6 comments
Assignees
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation KeyVault az keyvault Packaging Possible-Solution question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Similar-Issue Upgrade az upgrade
Milestone

Comments

@muonmax
Copy link

muonmax commented Jul 6, 2023

Describe the bug

After installing the Azure CLI on Debian 11 using either the "one step" install or the multi-step install az keyvault commands fail with a missing Python library error.

For example, the command:

az keyvault secret show --vault-name somer-vault -n SOME-KEY

fails with the following traceback:

CLIInternalError: The command failed with an unexpected error. Here is the traceback:
No module named 'azure.keyvault.v7_0'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 558, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 480, 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 315, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 106, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 75, in keyvault_arguments_loader
    op = get_op_handler()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 72, in get_op_handler
    return self.command_loader.get_op_handler(operations_tmpl.format(method_name))
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 829, in get_op_handler
    op = 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 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.keyvault.v7_0'

pip reports that the keyvault packages are installed:

root@5d506032b00b:/# pip3 list | grep keyvault
azure-keyvault                                   4.1.0
azure-keyvault-administration                    4.0.0b3
azure-keyvault-certificates                      4.2.2
azure-keyvault-keys                              4.3.2
azure-keyvault-secrets                           4.2.1
azure-mgmt-keyvault                              8.0.0

Downgrading to azure-keyvault==1.1.0 resolves the issue. This seems like the version requirements of the CLI are incorrect.

I also tried upgrading the CLI which failed.

Related command

az keyvault secret show --vault-name somer-vault -n SOME-KEY

Errors

CLIInternalError: The command failed with an unexpected error. Here is the traceback:
No module named 'azure.keyvault.v7_0'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 558, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 480, 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 315, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 106, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 75, in keyvault_arguments_loader
    op = get_op_handler()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 72, in get_op_handler
    return self.command_loader.get_op_handler(operations_tmpl.format(method_name))
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 829, in get_op_handler
    op = 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 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.keyvault.v7_0'

Issue script & Debug output

CLIInternalError: The command failed with an unexpected error. Here is the traceback:
No module named 'azure.keyvault.v7_0'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 558, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 480, 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 315, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3/dist-packages/knack/commands.py", line 106, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 75, in keyvault_arguments_loader
    op = get_op_handler()
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/keyvault/_command_type.py", line 72, in get_op_handler
    return self.command_loader.get_op_handler(operations_tmpl.format(method_name))
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 829, in get_op_handler
    op = 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 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.keyvault.v7_0'

Expected behavior

  • I would expect that azure-keyvault==1.1.0 is pinned in the requirements of the CLI so that az keyvault commands succeed.

Environment Summary

root@5d506032b00b:/# az --version
azure-cli                         2.18.0 *

core                              2.18.0 *
telemetry                          1.0.6

Extensions:
azure-devops                      0.19.0

Python location '/usr/bin/python3'
Extensions directory '/root/.azure/cliextensions'
Extensions system directory '/usr/lib/python3/dist-packages/azure-cli-extensions'

Python (Linux) 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110]

Legal docs and information: aka.ms/AzureCliLegal


You have 2 updates available. Consider updating your CLI installation with 'az upgrade'

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

Additional context

No response

@muonmax muonmax added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jul 6, 2023
@azure-client-tools-bot-prd
Copy link

Hi @muonmax,

This is not the official Azure CLI published by Microsoft.

How to tell if the installed Azure CLI is unofficial:

Please follow https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux to install Microsoft official Azure CLI.

If you feel that further discussion is needed, please add a comment with the text /clibot unresolve to reopen the issue.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Jul 6, 2023
@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot KeyVault az keyvault labels Jul 6, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 6, 2023

Thank you for opening this issue, we will look into it.

@ghost ghost assigned evelyn-ys Jul 6, 2023
@ghost ghost added this to the Backlog milestone Jul 6, 2023
@ghost ghost added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Upgrade az upgrade labels Jul 6, 2023
@ghost ghost assigned jiasli Jul 6, 2023
@azure-client-tools-bot-prd
Copy link

Hi @muonmax
Find similar issue #13101.

Issue title az keyvault show doesn't work on Ubuntu: ModuleNotFoundError: No module named 'azure.keyvault.v7_0'
Create time 2020-04-21
Comment number 10

Possible solution:
. The solution is to install the official Azure CLI from Microsoft Linux Repo. Please follow the instructions in the issue for the fix.


Please confirm if this resolves your issue.

@muonmax
Copy link
Author

muonmax commented Jul 6, 2023

FYI this is not actually closed/completed since the fix hasn't been made in the "one liner" installation or in the multi-step installation steps.

@attrobit
Copy link

Same problem on my side when using the official installation documentation for OpenSuse. I am using OpenSuse Tumbleweed.

@evelyn-ys evelyn-ys added Packaging and removed bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Aug 11, 2023
@evelyn-ys evelyn-ys assigned bebound and unassigned evelyn-ys Aug 11, 2023
@bebound
Copy link
Contributor

bebound commented Aug 11, 2023

@attrobit If the azure-cli package is provided by OpenSuse community, you should report this issue to them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation KeyVault az keyvault Packaging Possible-Solution question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Similar-Issue Upgrade az upgrade
Projects
None yet
Development

No branches or pull requests

6 participants