Azure / azure-cli

Azure Command-Line Interface
MIT License
4.04k stars 3.01k forks source link

Azure CLI V2 (azure-cli-2.45.0.msi) Error 1 module to load starting with 'azext_': got [] #25473

Open gailzmicrosoft opened 1 year ago

gailzmicrosoft commented 1 year ago

Encountered the error and tried to reinstall (repair, remove, install) Azure CLI azure-cli-2.45.0.msi but kept getting same:

Terminal (base) PS C:\Users\DirName> az version The command failed with an unexpected error. Here is the traceback: Expected 1 module to load starting with 'azext_': got [] Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 517, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/init.py", line 426, in load_command_table File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/init.py", line 320, in _update_command_table_from_extensions File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/init.py", line 307, in _filter_modname File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/extension/init.py", line 308, in get_extensionmodname AssertionError: Expected 1 module to load starting with 'azext': got [] To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

How did I get there? I was tring to install azure-cli-ml exension and it corrupted the Azure CLI.

Install and set up the CLI (v2) - Azure Machine Learning | Microsoft Learn

ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

yonzhan commented 1 year ago

@bebound for awareness

bebound commented 1 year ago

I guess the installation is interrupted.

Can you delete C:\Users\{your_user_name}\.azure\cliextensions\azure-cli-ml and install it again?

gailzmicrosoft commented 1 year ago

Thanks. My Machine has .Azure (not .azure).

C:\Users{your_user_name}\.Azure\cliextensions\account C:\Users{your_user_name}\.Azure\cliextensions\ml

I do not see azure-cli-mi

bebound commented 1 year ago

I see, please delete C:\Users{your_user_name}\.Azure\cliextensions\ml

gailzmicrosoft commented 1 year ago

@bebound: Thank you! I deleted below two items and then tried "az version". The error went away: C:\Users\{your_user_name}\.Azure\cliextensions\ml C:\Users\{your_user_name}\.azureml Hope this resolution help other users as well. Thank you again!