UserWarning: pkg_resources is deprecated as an API
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
- export PYTHONWARNINGS=ignore
- --only-show-errors
- pip install setuptools==80.8.0 --force-reinstall
Ref (was fixed on other parts of az cli): https://github.com/Azure/azure-cli/issues/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
Thank you for opening this issue, we will look into it.
@yonzhan, our company has a large number of developers experiencing this warning. What is the recommended course of action?
If we do not get a response in the next couple weeks, I will be submitting a ticket via azure portal to escalate.
We are experiencing it when using az artifacts. We predominantly use windows and almost all machines have the latest version of the extension and az cli.
cc: @necusjz
@aavalang for awareness.
@necusjz, @yonzhan & @aavalang: What is the status of this?
I was able to get it running again with:
$ az extension remove --name ssh
$ az extension add --name ssh
Edit: I still do get the warning, but it doesn't break. I'm able to ssh on to the VM.
It seems like the actual problem in my case was the line below the warning with No module named 'rpds.rpds'
This one disappeared after the reinstall of ssh.