azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Unable to install for Ubuntu 24.04

Open dixonwille opened this issue 9 months ago • 4 comments

Describe the bug

With Ubuntu 24.04 being released, I first checked to see if noble was available in https://packages.microsoft.com/repos/azure-cli/dists/.

Since it is not available yet, I tried to use the install script instead curl -L https://aka.ms/InstallAzureCli | bash.

Using the defaults for everything in the script (not specifying any strange paths for install directory or bin directory), I receive an error.

Related command

curl -L https://aka.ms/InstallAzureCli | bash

Errors

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1405  100  1405    0     0   1981      0 --:--:-- --:--:-- --:--:--  228k
Downloading Azure CLI install script from https://azurecliprod.blob.core.windows.net/install.py to /tmp/azure_cli_install_tmp_DELCpg.
######################################################################## 100.0%
/tmp/azure_cli_install_tmp_DELCpg: OK
Running install script.
-- Verifying Python version.
-- Python version 3.12.3 okay.
-- Verifying native dependencies.
-- Unable to verify native dependencies. dist=ubuntu, version=24.04. Continuing...

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

===> In what directory would you like to place the 'az' executable? (leave blank to use '/home/wdixon/bin'):
-- Creating directory '/home/wdixon/bin'.
-- The executable will be in '/home/wdixon/bin'.
-- Downloading virtualenv package from https://pypi.python.org/packages/source/v/virtualenv/virtualenv-16.7.11.tar.gz.
-- Downloaded virtualenv package to /tmp/tmp1d0rj52p/virtualenv-16.7.11.tar.gz.
-- Checksum of /tmp/tmp1d0rj52p/virtualenv-16.7.11.tar.gz OK.
-- Extracting '/tmp/tmp1d0rj52p/virtualenv-16.7.11.tar.gz' to '/tmp/tmp1d0rj52p'.
-- Executing: ['/usr/bin/python3', 'virtualenv.py', '--python', '/usr/bin/python3', '/home/wdixon/lib/azure-cli']
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/wdixon/lib/azure-cli/bin/python3
Also creating executable in /home/wdixon/lib/azure-cli/bin/python
ERROR: The executable /home/wdixon/lib/azure-cli/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/usr' (should be '/home/wdixon/lib/azure-cli')
ERROR: virtualenv is not compatible with this system or executable
Traceback (most recent call last):
  File "/tmp/azure_cli_install_tmp_DELCpg", line 415, in <module>
    main()
  File "/tmp/azure_cli_install_tmp_DELCpg", line 399, in main
    create_virtualenv(tmp_dir, install_dir)
  File "/tmp/azure_cli_install_tmp_DELCpg", line 144, in create_virtualenv
    exec_command(cmd, cwd=working_dir)
  File "/tmp/azure_cli_install_tmp_DELCpg", line 105, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'virtualenv.py', '--python', '/usr/bin/python3', '/home/wdixon/lib/azure-cli']' returned non-zero exit status 100.

Issue script & Debug output

N/A

Expected behavior

I would expect to either setup the PPA or use the Install script to successfully get a working version of the Azure CLI.

Environment Summary

$ python3 --version
Python 3.12.3

$ which python3
/usr/bin/python3

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

Additional context

No response

dixonwille avatar May 02 '24 01:05 dixonwille

Hi @dixonwille Find similar issue https://github.com/Azure/azure-cli/issues/23215.

Issue title Virtualenv step failing in install script
Create time 2022-07-15
Comment number 2

Possible solution: The error message in the new issue is similar to the error message in the old issue. The old issue suggests that the installation script is outdated and provides a guide to install azure-cli with pip. You can follow the guide to install azure-cli with pip.


Please confirm if this resolves your issue.

Ubuntu 24.04 support is planned in our next sprint.

yonzhan avatar May 02 '24 01:05 yonzhan

While the bot may have found a solution to my problem for now. With Ubuntu 24.04 being LTS and publicly released (no longer in preview), would love to see an official .deb package in the PPA (https://packages.microsoft.com/repos/azure-cli/dists/) with noble being supported.

dixonwille avatar May 02 '24 01:05 dixonwille

I can also confirm the same issue. Azure cli in previous 22.04 LTS had a release file and was working fine. But in latest 24.04 there is no way to get cli working. It is causing problem for developers who work in azure and want to be on the latest Ubuntu distro.

E: The repository 'https://packages.microsoft.com/repos/azure-cli noble Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default.

rakibmirza avatar May 03 '24 18:05 rakibmirza

@rakibmirza I wrote the following work around to get it installed. It assumes it is ran as root.

azureEnv="/usr/local/share/azure-cli-env"
python3 -m venv "$azureEnv"
"$azureEnv/bin/python" -m pip install --upgrade pip
"$azureEnv/bin/python" -m pip install --upgrade setuptools
"$azureEnv/bin/python" -m pip install azure-cli
ln -s "$azureEnv/bin/az" /usr/local/bin/az

dixonwille avatar May 03 '24 22:05 dixonwille

The install script is deprecated.

We'll release a package for 24.04

bebound avatar May 06 '24 03:05 bebound

@bebound Do we have an ETA on this? If not do we have any workaround?

PriyankaRudramaina avatar May 14 '24 08:05 PriyankaRudramaina

It will be released on May 21.

bebound avatar May 14 '24 09:05 bebound

@PriyankaRudramaina

@bebound Do we have an ETA on this? If not do we have any workaround?

See this comment for a workaround I am currently using.

https://github.com/Azure/azure-cli/issues/28872#issuecomment-2093817749

dixonwille avatar May 15 '24 16:05 dixonwille