Skip to content

[aks-preview] UserWarning: pkg_resources is deprecated as an API #8907

@sabbour

Description

@sabbour

Describe the bug

On the latest AKS preview extension version and the latest AKS CLI version, running any AKS preview command will result in this warning:

/.azure/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/__init__.py:6: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  __import__('pkg_resources').declare_namespace(__name__)

Related command

az aks namespace list

Errors

[.]/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/init.py:6: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import('pkg_resources').declare_namespace(name)

Issue script & Debug output

az aks namespace list --debug

cli.knack.cli: Command arguments: ['aks', 'namespace', 'list', '--debug']
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 0x738434d2b880>, <function OutputProducer.on_global_arguments at 0x738434a827a0>, <function CLIQuery.on_global_arguments at 0x738434ac7ce0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'aks': ['azext_aks_preview', 'azure.cli.command_modules.acs', 'azure.cli.command_modules.serviceconnector']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: acs                       0.044        15        79
cli.azure.cli.core: serviceconnector          0.047        20       331
cli.azure.cli.core: Total (2)                 0.091        35       410
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.knack.cli: Event: CommandLoader.OnLoadCommandTable []
cli.azure.cli.core: aks-preview               0.005        23       112  /home/../.azure/cliextensions/aks-preview
cli.azure.cli.core: Total (1)                 0.005        23       112
cli.azure.cli.core: Loaded 47 groups, 460 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : aks namespace list
cli.azure.cli.core: Command table: aks namespace list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x738433c24180>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/../.azure/commands/2025-06-27.01-33-42.aks_namespace_list.6916.log'.
az_command_data_logger: command args: aks namespace list --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x738433c7c680>]
cli.knack.cli: Event: CommandLoader.OnLoadArguments []
/home/../.azure/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/__init__.py:6: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  __import__('pkg_resources').declare_namespace(__name__)
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x738433c7ee80>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x738433c7efc0>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x738433c7f060>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x738434a82840>, <function CLIQuery.handle_query_parameter at 0x738434ac7d80>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x738433c7ef20>]
az_command_data_logger: extension name: aks-preview
az_command_data_logger: extension version: 18.0.0b15
Command group 'aks namespace' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ContainerServiceClient
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/../.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/../.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47
msal.authority: openid_config("https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/kerberos', 'tenant_region_scope': 'WW', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47
msal.authority: openid_config("https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/kerberos', 'tenant_region_scope': 'WW', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token_info: scopes=('https://management.core.windows.net//.default',), options={}
cli.azure.cli.core.auth.msal_credentials: UserCredential.acquire_token: scopes=['https://management.core.windows.net//.default'], claims_challenge=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 377da140-dbcb-4795-b838-5b95626c3acf
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/../resources?$filter=resourceType%20eq%20%27Microsoft.ContainerService%2FmanagedClusters%2FmanagedNamespaces%27&$expand=createdTime%2CchangedTime%2CprovisioningState&api-version=2024-11-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '6e65e84a-5331-11f0-be2e-00155d97f08b'
cli.azure.cli.core.sdk.policies:     'CommandName': 'aks namespace list'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.74.0 (DEB) azsdk-python-core/1.31.0 Python/3.12.10 (Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.39)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/../resources?$filter=resourceType%20eq%20%27Microsoft.ContainerService%2FmanagedClusters%2FmanagedNamespaces%27&$expand=createdTime%2CchangedTime%2CprovisioningState&api-version=2024-11-01 HTTP/1.1" 200 1317
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Length': '1317'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-reads': '1099'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-global-reads': '16499'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '76880271-d182-46b8-a385-ab22ed4c1d9b'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '76880271-d182-46b8-a385-ab22ed4c1d9b'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'WESTUS2:20250627T083343Z:76880271-d182-46b8-a385-ab22ed4c1d9b'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies:     'X-MSEdge-Ref': 'Ref A: F9E4130AE59F43C88E2C90D03957EE26 Ref B: MWH011020807025 Ref C: 2025-06-27T08:33:43Z'
cli.azure.cli.core.sdk.policies:     'Date': 'Fri, 27 Jun 2025 08:33:42 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"/subscriptions/../resourceGroups/automatic-rg/providers/Microsoft.ContainerService/managedClusters/automatic/managedNamespaces/contosoair","name":"automatic/contosoair","type":"Microsoft.ContainerService/managedClusters/managedNamespaces","location":"eastasia","createdTime":"2025-06-20T05:00:37.1781778Z","changedTime":"2025-06-20T05:10:58.1360062Z","provisioningState":"Succeeded","systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2025-06-20T05:00:37.199195Z","lastModifiedBy":"..","lastModifiedByType":"User","lastModifiedAt":"2025-06-20T05:00:37.199195Z"}},{"id":"/subscriptions/../resourceGroups/automatic-rg/providers/Microsoft.ContainerService/managedClusters/automatic/managedNamespaces/ioi","name":"automatic/ioi","type":"Microsoft.ContainerService/managedClusters/managedNamespaces","location":"eastasia","createdTime":"2025-06-26T19:12:46.7830565Z","changedTime":"2025-06-26T19:23:06.4777814Z","provisioningState":"Succeeded","systemData":{"createdBy":"","createdByType":"User","createdAt":"2025-06-26T19:12:46.7973929Z","lastModifiedBy":"..","lastModifiedByType":"User","lastModifiedAt":"2025-06-26T19:12:46.7973929Z"}}]}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x738433c7c400>, <function _x509_from_base64_to_hex_transform at 0x738433c7c4a0>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
[
  {
    "changedTime": "2025-06-20T05:10:58.136006+00:00",
    "createdTime": "2025-06-20T05:00:37.178177+00:00",
    "extendedLocation": null,
    "id": "/subscriptions/../resourceGroups/automatic-rg/providers/Microsoft.ContainerService/managedClusters/automatic/managedNamespaces/contosoair",
    "identity": null,
    "kind": null,
    "location": "eastasia",
    "managedBy": null,
    "name": "automatic/contosoair",
    "plan": null,
    "properties": null,
    "provisioningState": "Succeeded",
    "resourceGroup": "automatic-rg",
    "sku": null,
    "systemData": {
      "createdAt": "2025-06-20T05:00:37.199195Z",
      "createdBy": "..",
      "createdByType": "User",
      "lastModifiedAt": "2025-06-20T05:00:37.199195Z",
      "lastModifiedBy": "..",
      "lastModifiedByType": "User"
    },
    "tags": null,
    "type": "Microsoft.ContainerService/managedClusters/managedNamespaces"
  },
  {
    "changedTime": "2025-06-26T19:23:06.477781+00:00",
    "createdTime": "2025-06-26T19:12:46.783056+00:00",
    "extendedLocation": null,
    "id": "/subscriptions/..../resourceGroups/automatic-rg/providers/Microsoft.ContainerService/managedClusters/automatic/managedNamespaces/pwc",
    "identity": null,
    "kind": null,
    "location": "eastasia",
    "managedBy": null,
    "name": "automatic/ytt",
    "plan": null,
    "properties": null,
    "provisioningState": "Succeeded",
    "resourceGroup": "automatic-rg",
    "sku": null,
    "systemData": {
      "createdAt": "2025-06-26T19:12:46.7973929Z",
      "createdBy": "..",
      "createdByType": "User",
      "lastModifiedAt": "2025-06-26T19:12:46.7973929Z",
      "lastModifiedBy": "..",
      "lastModifiedByType": "User"
    },
    "tags": null,
    "type": "Microsoft.ContainerService/managedClusters/managedNamespaces"
  }
]
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x738433c24400>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 0.883 seconds (init: 0.090, invoke: 0.793)
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 4039 in cache file under /home/../.azure/telemetry/20250627013342745
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/__init__.py /home/../.azure /home/asabbour/.azure/telemetry/20250627013342745"
telemetry.process: Return from creating process 6936
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Not see the warning

Environment Summary

azure-cli 2.74.0

core 2.74.0
telemetry 1.1.0

Extensions:
aks-preview 18.0.0b15

Dependencies:
msal 1.32.3
azure-mgmt-resource 23.3.0

Python location '/opt/az/bin/python3'
Config directory '/home/../.azure'
Extensions directory '/home/../.azure/cliextensions'

Python (Linux) 3.12.10 (main, May 27 2025, 09:12:37) [GCC 13.3.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    AKSAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions