Skip to content

UserWarning: pkg_resources is deprecated as an APIΒ #8953

@ajjamieson

Description

@ajjamieson

Describe the bug

When running az network bastion ssh commands we recieve

/.azure/cliextensions/bastion/azext_bastion/custom.py:107: 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.
from pkg_resources import parse_version

This warning breaks our tooling, can the warning be silenced or the pkg_resource dependency be removed?

We've tried

  1. export PYTHONWARNINGS=ignore
  2. --only-show-errors
  3. pip install setuptools==80.8.0 --force-reinstall

Ref (was fixed on other parts of az cli):
Azure/azure-cli#31591

Versions:
azure-cli 2.75.0
core 2.75.0
telemetry 1.1.0
Extensions:
azure-devops 1.0.2
bastion 1.4.1
ssh 2.0.6

Related command

az network bastion ssh

Errors

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.
from pkg_resources import parse_version

Issue script & Debug output

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.
from pkg_resources import parse_version

Expected behavior

No Warning should be produced, the shell should be shown

Environment Summary

azure-cli 2.75.0

core 2.75.0
telemetry 1.1.0

Extensions:
azure-devops 1.0.2
bastion 1.4.1
ssh 2.0.6

Dependencies:
msal 1.33.0b1
azure-mgmt-resource 23.3.0

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

Python (Linux) 3.12.10 (main, Jun 24 2025, 10:15:05) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botNetwork - BastionService AttentionThis issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions