Azure / Azure/azure-cli-extensions

[azure-cli-ml] az extension add --name azure-cli-ml --version does not find most older extension versions

Open
#3,064 5 comments 0 reactions 0 assignees View on GitHub
ADO extension/ml Machine Learning ML-MLOps Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

- If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at [Azure/azure-cli](https://github.com/Azure/azure-cli/issues)

### Extension name (the extension in question)

azure-cli-ml

### Description of issue (in as much detail as possible)

**Describe the bug**

It seems like `az extension add --name azure-cli-ml --version` does not find most older extension versions.

**To Reproduce**

```
az version
{
"azure-cli": "2.19.1",
"azure-cli-core": "2.19.1",
"azure-cli-telemetry": "1.0.6",
"extensions": {}
}
```

```
az extension add --name azure-cli-ml --version 1.21.0 --debug
cli.knack.cli: Command arguments: ['extension', 'add', '--name', 'azure-cli-ml', '--version', '1.21.0', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
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.003 1 7
cli.azure.cli.core: Total (1) 0.003 1 7
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 []
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x7f4291109620>, .register_query_examples at 0x7f4291068d08>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x7f4291068d90>, .add_cache_arguments at 0x7f4291068ea0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .handle_example_parameter at 0x7f4291068c80>, .parse_ids_arguments at 0x7f4291068e18>]
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 763607
cli.azure.cli.core.extension._resolve: Candidates ['azure_cli_ml-1.23.0-py3-none-any.whl', 'azure_cli_ml-1.5.0-py2.py3-none-any.whl']
cli.azure.cli.core.extension._resolve: Candidates ['azure_cli_ml-1.23.0-py3-none-any.whl', 'azure_cli_ml-1.5.0-py2.py3-none-any.whl']
cli.azure.cli.core.extension._resolve: Candidates ['azure_cli_ml-1.23.0-py3-none-any.whl', 'azure_cli_ml-1.5.0-py2.py3-none-any.whl']
cli.azure.cli.core.extension.operations: Extension with version 1.21.0 not found
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/extension/_resolve.py", line 82, in resolve_from_index
chosen = [c for c in candidates_sorted if c['metadata']['version'] == target_version][0]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/extension/operations.py", line 307, in add_extension
source, ext_sha256 = resolve_from_index(extension_name, index_url=index_url, target_version=version)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/extension/_resolve.py", line 84, in resolve_from_index
raise NoExtensionCandidatesError('Extension with version {} not found'.format(target_version))
azure.cli.core.extension._resolve.NoExtensionCandidatesError: Extension with version 1.21.0 not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 727, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_job
six.reraise(*sys.exc_info())
File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise
raise value
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 698, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 331, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 816, in default_command_handler
return op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/extension/custom.py", line 18, in add_extension_cmd
version=version, upgrade=upgrade)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/extension/operations.py", line 315, in add_extension
raise CLIError(err)
knack.util.CLIError: No matching extensions for 'azure-cli-ml (1.21.0)'. Use --debug for more information.

cli.azure.cli.core.azclierror: No matching extensions for 'azure-cli-ml (1.21.0)'. Use --debug for more information.
cli.azure.cli.core.azclierror: No matching extensions for 'azure-cli-ml (1.21.0)'. Use --debug for more information.
cli.knack.cli: Event: Cli.PostExecute []
```

Installing the latest extension using the `--version` value works

```
az extension add --name azure-cli-ml --version 1.23.0
az version
{
"azure-cli": "2.19.1",
"azure-cli-core": "2.19.1",
"azure-cli-telemetry": "1.0.6",
"extensions": {
"azure-cli-ml": "1.23.0"
}
}
```

**Expected behavior**

The old versions are installable using the `--version` parameter.

**Environment summary**

```
cat /etc/*release | grep PRETTY
PRETTY_NAME="Ubuntu 18.04.5 LTS"
```

```
python --version
Python 3.7.10
```

```
/opt/az/bin/python3 --version
Python 3.6.10
```

**Additional context**

Most old extension versions are missing as candidates in the debug output

```
az extension add --name azure-cli-ml --version 1.21.0
...
urllib3.connectionpool: https://azcliextensionsync.blob.core.windows.net:443 "GET /index1/index.json HTTP/1.1" 200 763607
cli.azure.cli.core.extension._resolve: Candidates ['azure_cli_ml-1.23.0-py3-none-any.whl', 'azure_cli_ml-1.5.0-py2.py3-none-any.whl']
...
```

The installation of the other available version `az extension add --name azure-cli-ml --version 1.5.0` fails due to a different issue https://github.com/Azure/azure-cli/issues/16856

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.