Package Details: azure-cli 2.52.0-1

Git Clone URL: (read-only, click to copy)
Package Base: azure-cli
Description: Command-line tools for Azure.
Upstream URL:
Licenses: MIT
Conflicts: python-azure-cli
Submitter: pallxk
Maintainer: pallxk
Last Packager: pallxk
Votes: 39
Popularity: 0.91
First Submitted: 2019-12-30 09:10 (UTC)
Last Updated: 2023-09-07 00:33 (UTC)

Required by (3)

Sources (3)

Latest Comments

1 2 3 4 5 Next › Last »

lkrms commented on 2023-05-05 01:31 (UTC)

I considered going down the venv path too, but given the difference in features I wasn't confident that upstream didn't need some aspect of virtualenv's behaviour (although I wouldn't be surprised if it's just legacy code).

If it does need virtualenv, we could potentially use a venv environment to install virtualenv, and use THAT to create a virtualenv environment. Not ideal, though!

pallxk commented on 2023-05-05 01:22 (UTC)

@lkrms thanks for your patch. This definitely helps to solve the issue.

I've also tried another approach to use python venv in If you're interested, check it out here at

By depending on python-virtualenv, we solve the issue here with Arch Linux, but the change cannot be contributed to upstream. Let's see if using venv solves the problem well and then we can contribute upstream so we don't need to maintain a fork of

Side note, because of AUR ssh endpoint outage, I cannot push the change to AUR yet.

lkrms commented on 2023-05-05 01:16 (UTC)

I've fixed the issue. The way the azure-cli installer acquires and runs virtualenv doesn't work with virtualenv v20.x because of its dependencies. The PKGBUILD worked on my desktop machine only because it had python-virtualenv installed, but in a clean chroot it's not there as a fallback, so the module fails as soon as it tries to import anything.

It's a larger patch this time, so I won't copy and paste. Feel free to use (or not!) whatever changes are helpful from here:

lkrms commented on 2023-05-04 14:31 (UTC)

Thanks for your work to resolve this. Unfortunately the update doesn't build in a clean chroot here:

==> Starting prepare()...
-- Verifying Python version.
-- Python version 3.11.3 okay.

===> In what directory would you like to place the install? (leave blank to use '/build/lib/azure-cli'): -- Creating directory '/build/azure-cli/src/azure-cli'.
-- We will install at '/build/azure-cli/src/azure-cli'.

===> In what directory would you like to place the 'az' executable? (leave blank to use '/build/bin'): Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/tmp6_9d5qsk/virtualenv-20.23.0/src/virtualenv/", line 71, in <module>
    run_with_catch()  # pragma: no cov
  File "/tmp/tmp6_9d5qsk/virtualenv-20.23.0/src/virtualenv/", line 51, in run_with_catch
    from virtualenv.config.cli.parser import VirtualEnvOptions
ModuleNotFoundError: No module named 'virtualenv'
-- Creating directory '/build/azure-cli/src/bin'.
-- The executable will be in '/build/azure-cli/src/bin'.
-- Downloading virtualenv package from
-- Downloaded virtualenv package to /tmp/tmp6_9d5qsk/virtualenv-20.23.0.tar.gz.
-- Checksum of /tmp/tmp6_9d5qsk/virtualenv-20.23.0.tar.gz OK.
-- Extracting '/tmp/tmp6_9d5qsk/virtualenv-20.23.0.tar.gz' to '/tmp/tmp6_9d5qsk'.
-- Executing: ['/usr/bin/python', 'src/virtualenv', '--python', '/usr/bin/python', '/build/azure-cli/src/azure-cli']
Traceback (most recent call last):
  File "/build/azure-cli/src/", line 415, in <module>
  File "/build/azure-cli/src/", line 399, in main
    create_virtualenv(tmp_dir, install_dir)
  File "/build/azure-cli/src/", line 144, in create_virtualenv
    exec_command(cmd, cwd=working_dir)
  File "/build/azure-cli/src/", line 105, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/usr/lib/python3.11/", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', 'src/virtualenv', '--python', '/usr/bin/python', '/build/azure-cli/src/azure-cli']' returned non-zero exit status 1.

It makes sense not to tie the package to python310, although it's effectively tied to the version of Python packaged by Arch anyway, just because linking another Python version to, say, /usr/local/bin/python would probably break other packages. Nothing is ever easy, is it? ☹

pallxk commented on 2023-05-04 12:32 (UTC)

@lkrms Thanks for your patch for those who needs it.

I'm not going to make the package depend on python310 as it excludes the possibility to run with other versions of Python; on the other hand, by simply listing python, people can choose to install the Python version they want.

pallxk commented on 2023-05-04 12:22 (UTC)

Updated to use the latest version of virtualenv to support installation with Python 3.11 and 3.12.

Note that azure-cli has not yet officially supported on Python 3.11 or 3.12 yet as of azure-cli 2.48.1.

lkrms commented on 2023-05-04 10:18 (UTC)

@pallxk, you may not be interested in making this package depend on python310 until upstream support for 3.11 lands, but for anyone who needs it in the meantime, here's a PKGBUILD patch that's working here:

diff --git a/PKGBUILD b/PKGBUILD
index afdecc1..0361607 100644
@@ -8,7 +8,7 @@ pkgdesc="Command-line tools for Azure."
@@ -22,7 +22,7 @@ prepare() {
   rm -rf "$srcdir/azure-cli"

   # /usr/bin/python to ensure we use system python, rather than anaconda or something else.
-  grep -v -E '^===>|^$' install.response | python "$srcdir/install-$"
+  grep -v -E '^===>|^$' install.response | python3.10 "$srcdir/install-$"

   find "$srcdir/azure-cli/bin" -type f -print0 | xargs -0 sed -i -e "s|$srcdir|/opt|g"

pallxk commented on 2023-05-03 13:13 (UTC) (edited on 2023-05-03 13:13 (UTC) by pallxk)

@invidian The script is available at and we can version it with git tags, but git tags are not always pushed in time with the release.

There is also an (out-of-date) AUR package for azure-cli ( that simply uses pip, but it seems hard to maintain at least for me.

pallxk commented on 2023-05-03 12:59 (UTC)

@invidian azure-cli is not supported on Python 3.11 officially yet.

The error you're running into is related to an old version of virutalenv. But even if virtualenv is upgraded, (I think but I didn't try) azure-cli still won't work with Python 3.11 and there are several issues tracking this on GitHub.

invidian commented on 2023-05-02 10:22 (UTC)

I wonder, rather than using script which isn't versioned, can't we simply use pip for packaging azure-cli package? It seem it would be way simpler this way, as the installation script only downloads the virtualenv and runs pip inside it?