azure-cli
azure-cli copied to clipboard
az cli version 2.65.0 is failing to load `azure-devops`
Describe the bug
I had to update my azure CLI and now I can't download artifacts using azure cli.
Unable to load extension 'azure-devops: No module named 'pkg_resources''. Use --debug for more information.
Preview version of extension is enabled by default for extension installation now. Will be disabled in future release.
Please run 'az config set extension.dynamic_install_allow_preview=true or false' to config it specifically.
The command requires the extension azure-devops. Do you want to install it now? The command will continue to run after the extension is installed. (Y/n): y
Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
Extension 'azure-devops' 0.26.0 is already installed.
It will be overridden with version 1.0.1.
Default enabled including preview versions for extension installation now. Disabled in future release. Use '--allow-preview true' to enable it specifically if needed. Use '--allow-preview false' to install stable version only.
An error occurred whilst updating.
An error occurred. Pip failed with status code 1. Use --debug for more information.
Failed to update. Rolled azure-devops back to 0.26.0.
I've tried using different versions of python locally and nothing is working
Related command
--organization "org/url" \
--project "project id" \
--scope project \
--feed "feed" \
--name "name" \
--version "$VERSION" \
--path .```
### Errors
cli.azure.cli.core.extension.operations: An error occurred whilst updating.
cli.azure.cli.core.extension.operations: An error occurred. Pip failed with status code 1. Use --debug for more information.
cli.azure.cli.core.azclierror: Failed to update. Rolled azure-devops back to 0.26.0.
az_command_data_logger: Failed to update. Rolled azure-devops back to 0.26.0.
### Issue script & Debug output
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 4653417 cli.azure.cli.core.extension._resolve: Candidates ['azure_devops-0.12.0-py2.py3-none-any.whl', 'azure_devops-0.17.0-py2.py3-none-any.whl', 'azure_devops-0.21.0-py2.py3-none-any.whl', 'azure_devops-0.26.0-py2.py3-none-any.whl', 'azure_devops-1.0.0-py2.py3-none-any.whl', 'azure_devops-1.0.1-py2.py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Candidates ['azure_devops-0.12.0-py2.py3-none-any.whl', 'azure_devops-0.17.0-py2.py3-none-any.whl', 'azure_devops-0.21.0-py2.py3-none-any.whl', 'azure_devops-0.26.0-py2.py3-none-any.whl', 'azure_devops-1.0.0-py2.py3-none-any.whl', 'azure_devops-1.0.1-py2.py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Skipping 'azure_devops-0.12.0-py2.py3-none-any.whl' as 0.12.0 not greater than current version 0.26.0 cli.azure.cli.core.extension._resolve: Skipping 'azure_devops-0.17.0-py2.py3-none-any.whl' as 0.17.0 not greater than current version 0.26.0 cli.azure.cli.core.extension._resolve: Skipping 'azure_devops-0.21.0-py2.py3-none-any.whl' as 0.21.0 not greater than current version 0.26.0 cli.azure.cli.core.extension._resolve: Skipping 'azure_devops-0.26.0-py2.py3-none-any.whl' as 0.26.0 not greater than current version 0.26.0 cli.azure.cli.core.extension._resolve: Candidates ['azure_devops-1.0.0-py2.py3-none-any.whl', 'azure_devops-1.0.1-py2.py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Candidates ['azure_devops-1.0.0-py2.py3-none-any.whl', 'azure_devops-1.0.1-py2.py3-none-any.whl'] cli.azure.cli.core.extension._resolve: Chosen {'downloadUrl': 'https://github.com/Azure/azure-devops-cli-extension/releases/download/20240514.1/azure_devops-1.0.1-py2.py3-none-any.whl', 'filename': 'azure_devops-1.0.1-py2.py3-none-any.whl', 'metadata': {'azext.minCliCoreVersion': '2.30.0', 'classifiers': ['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT License'], 'extensions': {'python.details': {'contacts': [{'email': '[email protected]', 'name': 'Microsoft', 'role': 'author'}], 'document_names': {'description': 'DESCRIPTION.rst'}, 'project_urls': {'Home': 'https://github.com/Microsoft/azure-devops-cli-extension'}}}, 'extras': [], 'generator': 'bdist_wheel (0.30.0)', 'license': 'MIT', 'metadata_version': '2.0', 'name': 'azure-devops', 'run_requires': [{'requires': ['distro (==1.3.0)', 'distro==1.3.0']}], 'summary': 'Tools for managing Azure DevOps.', 'version': '1.0.1'}, 'sha256Digest': 'f300d0288f017148514ebe6f5912aef10c7a6f29bdc0c916b922edf1d75bc7db'}
cli.azure.cli.core.extension.operations: Downloading https://github.com/Azure/azure-devops-cli-extension/releases/download/20240514.1/azure_devops-1.0.1-py2.py3-none-any.whl to /var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl urllib3.connectionpool: Starting new HTTPS connection (1): github.com:443 urllib3.connectionpool: https://github.com:443 "GET /Azure/azure-devops-cli-extension/releases/download/20240514.1/azure_devops-1.0.1-py2.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/107708057/77ec1ba4-6f10-4d2b-bb30-9c1d420c4fbc?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241018T160844Z&X-Amz-Expires=300&X-Amz-Signature=23f212e4d91d8a604e23eb2e2684088d83e9144507b806399dc43882141630b5&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dazure_devops-1.0.1-py2.py3-none-any.whl&response-content-type=application%2Foctet-stream HTTP/1.1" 200 1195727 cli.azure.cli.core.extension.operations: Downloaded to /var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl cli.azure.cli.core.extension.operations: Validating the extension /var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl cli.azure.cli.core.extension.operations: Checksum of /var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl is OK cli.azure.cli.core.extension.operations: Validation successful on /var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl cli.azure.cli.core.extension.operations: Linux distro check: Reading from: /etc/apt/sources.list.d/azure-cli.list cli.azure.cli.core.extension.operations: Linux distro check: An error occurred while checking linux distribution version source list consistency. cli.azure.cli.core.extension.operations: [Errno 2] No such file or directory: '/etc/apt/sources.list.d/azure-cli.list' cli.azure.cli.core.extension.operations: Executing pip with args: ['install', '--target', '/Users/jacob/.azure/cliextensions/azure-devops', '/var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl'] cli.azure.cli.core.extension.operations: Running: ['/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python', '-m', 'pip', 'install', '--target', '/Users/jacob/.azure/cliextensions/azure-devops', '/var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir'] cli.azure.cli.core.extension.operations: /opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python: No module named pip
cli.azure.cli.core.extension.operations: Command '['/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python', '-m', 'pip', 'install', '--target', '/Users/jacob/.azure/cliextensions/azure-devops', '/var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpma3oqmte/azure_devops-1.0.1-py2.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 /Users/jacob/.azure/cliextensions/azure-devops cli.azure.cli.core.extension.operations: An error occurred whilst updating. cli.azure.cli.core.extension.operations: An error occurred. Pip failed with status code 1. Use --debug for more information. cli.azure.cli.core.extension.operations: Copying /var/folders/r8/lrj6fb6j4pl5vcznvn8gdb6m0000gn/T/tmpzez3o3_s/azure-devops to /Users/jacob/.azure/cliextensions/azure-devops cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/extension/operations.py", line 440, in update_extension _add_whl_ext(cli_ctx=cmd_cli_ctx, source=download_url, ext_sha256=ext_sha256, File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/extension/operations.py", line 172, in _add_whl_ext raise CLIError('An error occurred. Pip failed with status code {}. ' knack.util.CLIError: An error occurred. Pip failed with status code 1. Use --debug for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 591, in execute parsed_args = self.parser.parse_args(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/knack/parser.py", line 261, in parse_args return super().parse_args(args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 1895, in parse_args args, argv = self.parse_known_args(args, namespace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 1931, in parse_known_args namespace, args = self._parse_known_args(args, namespace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 2150, in _parse_known_args positionals_end_index = consume_positionals(start_index) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 2127, in consume_positionals take_action(action, args) File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 1991, in take_action argument_values = self._get_values(action, argument_strings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/parser.py", line 272, in _get_values value = super(AzCliCommandParser, self)._get_values(action, arg_strings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 2545, in _get_values self._check_value(action, value[0]) File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/parser.py", line 300, in _check_value use_dynamic_install = try_install_extension(self, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/extension/dynamic_install.py", line 132, in try_install_extension _check_value_in_extensions(cli_ctx, parser, args, use_dynamic_install == 'yes_without_prompt') File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/extension/dynamic_install.py", line 242, in _check_value_in_extensions add_extension(cli_ctx=cli_ctx, extension_name=ext_name, upgrade=True, allow_preview=extension_allow_preview) File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/extension/operations.py", line 346, in add_extension update_extension(cmd=cmd, extension_name=extension_name, index_url=index_url, pip_extra_index_urls=pip_extra_index_urls, pip_proxy=pip_proxy, cli_ctx=cli_ctx, version=ext_version, download_url=source, ext_sha256=ext_sha256) File "/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/lib/python3.12/site-packages/azure/cli/core/extension/operations.py", line 449, in update_extension raise CLIError('Failed to update. Rolled {} back to {}.'.format(extension_name, cur_version)) knack.util.CLIError: Failed to update. Rolled azure-devops back to 0.26.0.
### Expected behavior
I should be able to download artifacts with azure cli
### Environment Summary
azure-cli 2.65.0
core 2.65.0
telemetry 1.1.0
Extensions:
azure-devops 0.26.0
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Python location '/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python'
Extensions directory '/Users/jacob/.azure/cliextensions'
Python (Darwin) 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.3.9.4)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
### Additional context
_No response_
Thank you for opening this issue, we will look into it.
Here are some similar issues that might help you. Please check if they can solve your problem.
- #29981
- #15931
encounter the same issue any updates pls, thanks
I checked the recommend GitHub issues and nothing there fixed my problem.
It seems it for sure a problem with the latest cli. Was able to replicate on a different machine
Bump, same problem
Similar problem with az storage blob download:
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
self.commands_loader.load_arguments(command)
File "/opt/homebrew/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 527, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/command_modules/storage/__init__.py", line 42, in load_arguments
load_arguments(self, command)
File "/opt/homebrew/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/command_modules/storage/_params.py", line 758, in load_arguments
get_permission_help_string(t_account_permissions)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/command_modules/storage/_validators.py", line 871, in get_permission_help_string
return ' '.join(['({}){}'.format(x[0], x[1:]) for x in allowed_values])
^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
From my perspective, it could be caused by: https://github.com/Azure/azure-cli/issues/30148
This is fixed for me with /opt/homebrew/Cellar/azure-cli/2.65.0_2, which I just got by doing brew upgrade.
az --version still reports 2.65.0, but the _2 in the install dir name is key.
brew upgrade also fixed this for me with 2.65.0_2
seems like they fixed it, its working now
It is not fixed. Fresh install on Windows, I am not going to post the debug output but this is what "fixed" it for me:
- get the failing command from the debug output (thanks whoever decided to log quotes)
- remove the path to python and just use
pythonhoping it will pick a working one - remove
--disable-pip-version-check - run the command
In my case it was
python.exe -m pip install --target 'C:\\Users\\darkoa\\.azure\\cliextensions\\azure-devops' 'C:\\Users\\darkoa\\AppData\\Local\\Temp\\tmp2c989ng9\\azure_devops-1.0.1-py2.py3-none-any.whl' -vv --no-cache-dir
azure-cli 2.67.0
core 2.67.0
telemetry 1.1.0
Extensions:
azure-devops 1.0.1
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\darkoa\.azure\cliextensions'
Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
As a workaround, and I have not had this issue on a Mac yet, but I did experience it on windows.
- On windows I used the whl endpoint that the
az extension add azure-devops --debugcommand provided. - From there I used the WHL file to directly install the package using Pip (fully expecting to get the same error and need to debug more, but that was not needed). Here is the command,
pip install --target "C:\Users\<USER>\.azure\cliextensions\azure-devops" "C:\<PATH TO WHL FILE LOCALLY>.whl" --no-cache-dirand it successfully installed. - Run
az extension add azure-devops --debugand it says the extension is already installed.
The previous example assumes that the WHL file is already on the machine, however in my case I actually had to download it from github based on the endpoints in the debug log.