Azure / azure-iot-ops-cli-extension

Azure IoT Ops extension for Azure CLI
MIT License
9 stars 8 forks source link

[bug] Unable to upgrade or install extension version 0.5.1b1 #253

Closed jaypaddy closed 2 months ago

jaypaddy commented 2 months ago

Describe the bug I had a previous version of az iot ops extension (0.3.0b2) and this had worked in the past. Wanted to deploy az iot ops and so before deploying, wanted to upgrade the extension. The upgrade failed. And hence removed the previous version of the extension, upgraded az cli to 2.61 and then tried adding az iot ops extension. But get the same error message....

PS C:\Users\japadman.kube> az extension add --name azure-iot-ops --debug --allow-preview cli.knack.cli: Command arguments: ['extension', 'add', '--name', 'azure-iot-ops', '--debug', '--allow-preview'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x00000284F1B9B880>, <function OutputProducer.on_global_arguments at 0x00000284F1D260C0>, <function CLIQuery.on_global_arguments at 0x00000284F1D53C40>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'extension': ['azure.cli.command_modules.extension'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: extension 0.009 1 7 cli.azure.cli.core: Total (1) 0.009 1 7 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: Total (0) 0.000 0 0 cli.azure.cli.core: Loaded 1 groups, 7 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : extension add cli.azure.cli.core: Command table: extension add cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x00000284F4C7E340>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\japadman.azure\commands\2024-06-30.18-35-06.extension_add.7292.log'. az_command_data_logger: command args: extension add --name {} --debug --allow-preview cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x00000284F4D0C860>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x00000284F4D0C900>, <function register_cache_arguments..add_cache_arguments at 0x00000284F4D0CA40>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x00000284F1D26160>, <function CLIQuery.handle_query_parameter at 0x00000284F1D53CE0>, <function register_ids_argument..parse_ids_arguments at 0x00000284F4D0C9A0>] urllib3.connectionpool: Starting new HTTPS connection (1): aka.ms:443 urllib3.connectionpool: https://aka.ms:443 "GET /azure-cli-extension-index-v1 HTTP/1.1" 301 0 urllib3.connectionpool: Starting new HTTPS connection (1): azcliextensionsync.blob.core.windows.net:443 urllib3.connectionpool: https://azcliextensionsync.blob.core.windows.net:443 "GET /index1/index.json HTTP/1.1" 200 4198839 cli.azure.cli.core.extension._resolve: Candidates ['azure_iot_ops-0.1.0b1-py3-none-any.whl', 'azure_iot_ops-0.1.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b1-py3-none-any.whl', 'azure_iot_ops-0.2.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b4-py3-none-any.whl', 'azure_iot_ops-0.3.0b1-py3-none-any.whl', 'azure_iot_ops-0.3.0b2-py3-none-any.whl', 'azure_iot_ops-0.3.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b1-py3-none-any.whl', 'azure_iot_ops-0.4.0b2-py3-none-any.whl', 'azure_iot_ops-0.4.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b4-py3-none-any.whl', 'azure_iot_ops-0.5.0b1-py3-none-any.whl', 'azure_iot_ops-0.5.0b2-py3-none-any.whl', 'azure_iot_ops-0.5.1b1-py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Candidates ['azure_iot_ops-0.1.0b1-py3-none-any.whl', 'azure_iot_ops-0.1.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b1-py3-none-any.whl', 'azure_iot_ops-0.2.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b4-py3-none-any.whl', 'azure_iot_ops-0.3.0b1-py3-none-any.whl', 'azure_iot_ops-0.3.0b2-py3-none-any.whl', 'azure_iot_ops-0.3.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b1-py3-none-any.whl', 'azure_iot_ops-0.4.0b2-py3-none-any.whl', 'azure_iot_ops-0.4.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b4-py3-none-any.whl', 'azure_iot_ops-0.5.0b1-py3-none-any.whl', 'azure_iot_ops-0.5.0b2-py3-none-any.whl', 'azure_iot_ops-0.5.1b1-py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Candidates ['azure_iot_ops-0.1.0b1-py3-none-any.whl', 'azure_iot_ops-0.1.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b1-py3-none-any.whl', 'azure_iot_ops-0.2.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b4-py3-none-any.whl', 'azure_iot_ops-0.3.0b1-py3-none-any.whl', 'azure_iot_ops-0.3.0b2-py3-none-any.whl', 'azure_iot_ops-0.3.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b1-py3-none-any.whl', 'azure_iot_ops-0.4.0b2-py3-none-any.whl', 'azure_iot_ops-0.4.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b4-py3-none-any.whl', 'azure_iot_ops-0.5.0b1-py3-none-any.whl', 'azure_iot_ops-0.5.0b2-py3-none-any.whl', 'azure_iot_ops-0.5.1b1-py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Candidates ['azure_iot_ops-0.1.0b1-py3-none-any.whl', 'azure_iot_ops-0.1.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b1-py3-none-any.whl', 'azure_iot_ops-0.2.0b2-py3-none-any.whl', 'azure_iot_ops-0.2.0b4-py3-none-any.whl', 'azure_iot_ops-0.3.0b1-py3-none-any.whl', 'azure_iot_ops-0.3.0b2-py3-none-any.whl', 'azure_iot_ops-0.3.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b1-py3-none-any.whl', 'azure_iot_ops-0.4.0b2-py3-none-any.whl', 'azure_iot_ops-0.4.0b3-py3-none-any.whl', 'azure_iot_ops-0.4.0b4-py3-none-any.whl', 'azure_iot_ops-0.5.0b1-py3-none-any.whl', 'azure_iot_ops-0.5.0b2-py3-none-any.whl', 'azure_iot_ops-0.5.1b1-py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Chosen {'downloadUrl': 'https://github.com/Azure/azure-iot-ops-cli-extension/releases/download/v0.5.1b1/azure_iot_ops-0.5.1b1-py3-none-any.whl', 'filename': 'azure_iot_ops-0.5.1b1-py3-none-any.whl', 'metadata': {'azext.isPreview': True, 'azext.minCliCoreVersion': '2.46.0', 'classifiers': ['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11'], 'extensions': {'python.details': {'contacts': [{'email': 'iotupx@microsoft.com', 'name': 'Microsoft', 'role': 'author'}], 'document_names': {'description': 'DESCRIPTION.rst'}, 'project_urls': {'Home': 'https://github.com/azure/azure-iot-ops-cli-extension'}}}, 'extras': [], 'generator': 'bdist_wheel (0.30.0)', 'license': 'MIT', 'license_file': 'LICENSE', 'metadata_version': '2.0', 'name': 'azure-iot-ops', 'requires_python': '>=3.8', 'run_requires': [{'requires': ['azure-identity (<2.0,>=1.14.1)', 'kubernetes (<29.0,>=27.2)', 'opentelemetry-proto (~=1.20.0)', 'packaging (>=23.2)', 'protobuf (~=4.25.0)', 'rich (<14.0,>=13.6)']}], 'summary': 'The Azure IoT Operations extension for Azure CLI.', 'version': '0.5.1b1'}, 'sha256Digest': '09a63dbd9dc976235fe295eb78083fa6141f52db6dde9c8c25975c23f1f79fe4'} cli.azure.cli.core.extension.operations: Extension source is url? True cli.azure.cli.core.extension.operations: Downloading https://github.com/Azure/azure-iot-ops-cli-extension/releases/download/v0.5.1b1/azure_iot_ops-0.5.1b1-py3-none-any.whl to C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl urllib3.connectionpool: Starting new HTTPS connection (1): github.com:443 urllib3.connectionpool: https://github.com:443 "GET /Azure/azure-iot-ops-cli-extension/releases/download/v0.5.1b1/azure_iot_ops-0.5.1b1-py3-none-any.whl HTTP/1.1" 302 0 urllib3.connectionpool: Starting new HTTPS connection (1): objects.githubusercontent.com:443 urllib3.connectionpool: https://objects.githubusercontent.com:443 "GET /github-production-release-asset-2e65be/645100332/02a96658-8e36-41bd-bffc-83a8ded48532?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240630%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240630T233434Z&X-Amz-Expires=300&X-Amz-Signature=213d3d7c2cbc8480efac95f17e4bd73b98d722f73a033c1bb8578ab6ecc1b1c4&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=645100332&response-content-disposition=attachment%3B%20filename%3Dazure_iot_ops-0.5.1b1-py3-none-any.whl&response-content-type=application%2Foctet-stream HTTP/1.1" 200 167860 cli.azure.cli.core.extension.operations: Downloaded to C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl cli.azure.cli.core.extension.operations: Validating the extension C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl cli.azure.cli.core.extension.operations: Checksum of C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl is OK cli.azure.cli.core.extension.operations: Validation successful on C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl cli.azure.cli.core.extension.operations: Executing pip with args: ['install', '--target', 'C:\Users\japadman\.azure\cliextensions\azure-iot-ops', 'C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl'] cli.azure.cli.core.extension.operations: Running: ['C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe', '-m', 'pip', 'install', '--target', 'C:\Users\japadman\.azure\cliextensions\azure-iot-ops', 'C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir'] cli.azure.cli.core.extension.operations: Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip__main.py", line 22, in from pip._internal.cli.main import main as _main File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\cli\main.py", line 10, in from pip._internal.cli.autocompletion import autocomplete File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\cli\autocompletion.py", line 10, in from pip._internal.cli.main_parser import create_main_parser File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\cli\main_parser.py", line 9, in from pip._internal.build_env import get_runnable_pip File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\build_env.py", line 19, in from pip._internal.cli.spinners import open_spinner File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\cli\spinners.py", line 9, in from pip._internal.utils.logging import get_indentation File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\utils\logging.py", line 29, in from pip._internal.utils.misc import ensure_dir File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\utils\misc.py", line 44, in from pip._internal.locations import get_major_minor_version File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\locations__init.py", line 14, in from . import _sysconfig File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\locations_sysconfig.py", line 11, in from .base import change_root, get_major_minor_version, is_osx_framework File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\locations\base.py", line 9, in from pip._internal.utils import appdirs File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_internal\utils\appdirs.py", line 13, in from pip._vendor import platformdirs as _appdirs File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_vendor\platformdirs__init__.py", line 46, in PlatformDirs = _set_platform_dir_class() #: Currently active platform ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_vendor\platformdirs\init__.py", line 26, in _set_platform_dir_class from pip._vendor.platformdirs.windows import Windows as Result File "C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pip_vendor\platformdirs\windows.py", line 4, in import ctypes File "ctypes\init__.py", line 8, in ImportError: DLL load failed while importing _ctypes: The specified module could not be found.

cli.azure.cli.core.extension.operations: Command '['C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe', '-m', 'pip', 'install', '--target', 'C:\Users\japadman\.azure\cliextensions\azure-iot-ops', 'C:\Users\japadman\AppData\Local\Temp\tmpb85pqcj2\azure_iot_ops-0.5.1b1-py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1. cli.azure.cli.core.extension.operations: Pip failed so deleting anything we might have installed at C:\Users\japadman.azure\cliextensions\azure-iot-ops cli.azure.cli.core.azclierror: 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 664, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 731, in _run_jobs_serially File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 701, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 334, in call File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/extension/custom.py", line 16, in add_extension_cmd File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/extension/operations.py", line 349, in add_extension File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/extension/operations.py", line 172, in _add_whl_ext knack.util.CLIError: An error occurred. Pip failed with status code 1. Use --debug for more information.

cli.azure.cli.core.azclierror: An error occurred. Pip failed with status code 1. Use --debug for more information. az_command_data_logger: An error occurred. Pip failed with status code 1. Use --debug for more information. cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x00000284F4C7E5C0>] az_command_data_logger: exit code: 1 cli.main: Command ran in 6.481 seconds (init: 0.813, invoke: 5.667) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3834 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry__init__.pyc C:\Users\japadman.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.

jaypaddy commented 2 months ago

This issue is related to an azure cli problem as mentioned here

i started the install after explicitly setting the path as suggested in one of the comments and then the install of az iot ops extension happened. $ENV:PYTHONPATH = "C:\Program Files\Microsoft SDKs\Azure\CLI2"

Unable to add azure-devops extension in Azure CLI v2.56.0 on Windows: ImportError: DLL load failed while importing _ctypes: The specified module could not be found. · Issue #28303 · Azure/azure-cli (github.com)