Skip to content

az fails to run when a venv w/some azure modules is activated on Azure Linux 3 #31843

@brsmyth

Description

@brsmyth

Describe the bug

All az commands fail to run when in the following configuration:

  • Azure Linux 3
  • azure-cli installed via tdnf
  • A venv is activated
  • The venv has some azure packages installed, but not azure.cli

Related command

az --version

Errors

% az --version
azure-cli                         2.75.0

core                              2.75.0
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.2
connectedk8s                      1.10.7
k8s-extension                      1.6.5

Dependencies:
msal                            1.33.0b1
azure-mgmt-resource               23.3.0

Python location '/usr/bin/python3.12'
Config directory '/home/acsa/.azure'
Extensions directory '/home/acsa/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.12/site-packages/azure-cli-extensions'

Python (Linux) 3.12.9 (main, Jun 12 2025, 19:38:44) [GCC 13.2.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.
% . .venv/bin/activate
(redacted) % /usr/bin/az --version
/workspace/redacted/redacted/.venv/lib/python3.12/site-packages/azure/__init__.py:5: 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
/workspace/redacted/redacted/.venv/bin/python3.12: No module named azure.cli
(redacted) % ls .venv/lib64/python3.12/site-packages/azure | wc -l
11
(redacted) % ls .venv/lib64/python3.12/site-packages/azure/cli
ls: cannot access '.venv/lib64/python3.12/site-packages/azure/cli': No such file or directory
(redacted) % deactivate
% az --version
azure-cli                         2.75.0

core                              2.75.0
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.2
connectedk8s                      1.10.7
k8s-extension                      1.6.5

Dependencies:
msal                            1.33.0b1
azure-mgmt-resource               23.3.0

Python location '/usr/bin/python3.12'
Config directory '/home/acsa/.azure'
Extensions directory '/home/acsa/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.12/site-packages/azure-cli-extensions'

Python (Linux) 3.12.9 (main, Jun 12 2025, 19:38:44) [GCC 13.2.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Issue script & Debug output

az --debug --version
/workspace/redacted/redacted/.venv/lib/python3.12/site-packages/azure/__init__.py:5: 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
/workspace/redacted/redacted/.venv/bin/python3.12: No module named azure.cli

Expected behavior

I would expect the same behavior from az with the venv both activated and not.

Environment Summary

% az --version
azure-cli                         2.75.0

core                              2.75.0
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.2
connectedk8s                      1.10.7
k8s-extension                      1.6.5

Dependencies:
msal                            1.33.0b1
azure-mgmt-resource               23.3.0

Python location '/usr/bin/python3.12'
Config directory '/home/acsa/.azure'
Extensions directory '/home/acsa/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.12/site-packages/azure-cli-extensions'

Python (Linux) 3.12.9 (main, Jun 12 2025, 19:38:44) [GCC 13.2.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

Labels

Azure CLI TeamThe command of the issue is owned by Azure CLI teamPossible-SolutionSimilar-IssuequestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions