Azure / Azure/azure-cli

Install on Linux alpine with install script fails

Open
#32,738 2 comments 0 reactions 1 assignee Claimed by @bebound View on GitHub
act-platform-engineering-squad Azure CLI Team Installation Possible-Solution question Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Use install script from docs fails because no module named `distutils`.

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

### Related command

No related to a command

### Errors

`ModuleNotFoundError: No module named 'distutils'`

```
% 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 4252 0 --:--:-- --:--:-- --:--:-- 4252
Downloading Azure CLI install script from https://azurecliprod.blob.core.windows.net/install.py to /tmp/azure_cli_install_tmp_wK6jl9.
######################################################################## 100.0%
/tmp/azure_cli_install_tmp_wK6jl9: OK
Running install script.
-- Verifying Python version.
-- Python version 3.12.12 okay.
-- Verifying native dependencies.
-- Unable to verify native dependencies. dist=alpine linux, version=3.23.3. Continuing...

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

===> In what directory would you like to place the 'az' executable? (leave blank to use '/home/vscode/bin'):
-- The executable will be in '/home/vscode/bin'.
-- Downloading virtualenv package from https://pypi.python.org/packages/source/v/virtualenv/virtualenv-16.7.11.tar.gz.
-- Downloaded virtualenv package to /tmp/tmpfha73e2w/virtualenv-16.7.11.tar.gz.
-- Checksum of /tmp/tmpfha73e2w/virtualenv-16.7.11.tar.gz OK.
-- Extracting '/tmp/tmpfha73e2w/virtualenv-16.7.11.tar.gz' to '/tmp/tmpfha73e2w'.
/tmp/azure_cli_install_tmp_wK6jl9:139: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
package_tar.extractall(path=tmp_dir)
-- Executing: ['/usr/bin/python3', 'virtualenv.py', '--python', '/usr/bin/python3', '/home/vscode/lib/azure-cli']
Traceback (most recent call last):
File "/tmp/tmpfha73e2w/virtualenv-16.7.11/virtualenv.py", line 24, in
import distutils.spawn
ModuleNotFoundError: No module named 'distutils'
Traceback (most recent call last):
File "/tmp/azure_cli_install_tmp_wK6jl9", line 415, in
main()
File "/tmp/azure_cli_install_tmp_wK6jl9", line 399, in main
create_virtualenv(tmp_dir, install_dir)
File "/tmp/azure_cli_install_tmp_wK6jl9", line 144, in create_virtualenv
exec_command(cmd, cwd=working_dir)
File "/tmp/azure_cli_install_tmp_wK6jl9", 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/vscode/lib/azure-cli']' returned non-zero exit status 1.
```

### Issue script & Debug output

```
@diberry ➜ /workspaces/cosmos-db-vector-samples (copilot/create-cosmos-db-vector-store) $ e
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.23.3
PRETTY_NAME="Alpine Linux v3.23"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
@diberry ➜ /workspaces/cosmos-db-vector-samples (copilot/create-cosmos-db-vector-store) $ curl -L https://aka.ms/InstallAzureCli | bash
% 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 4252 0 --:--:-- --:--:-- --:--:-- 4252
Downloading Azure CLI install script from https://azurecliprod.blob.core.windows.net/install.py to /tmp/azure_cli_install_tmp_wK6jl9.
######################################################################## 100.0%
/tmp/azure_cli_install_tmp_wK6jl9: OK
Running install script.
-- Verifying Python version.
-- Python version 3.12.12 okay.
-- Verifying native dependencies.
-- Unable to verify native dependencies. dist=alpine linux, version=3.23.3. Continuing...

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

===> In what directory would you like to place the 'az' executable? (leave blank to use '/home/vscode/bin'):
-- The executable will be in '/home/vscode/bin'.
-- Downloading virtualenv package from https://pypi.python.org/packages/source/v/virtualenv/virtualenv-16.7.11.tar.gz.
-- Downloaded virtualenv package to /tmp/tmpfha73e2w/virtualenv-16.7.11.tar.gz.
-- Checksum of /tmp/tmpfha73e2w/virtualenv-16.7.11.tar.gz OK.
-- Extracting '/tmp/tmpfha73e2w/virtualenv-16.7.11.tar.gz' to '/tmp/tmpfha73e2w'.
/tmp/azure_cli_install_tmp_wK6jl9:139: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
package_tar.extractall(path=tmp_dir)
-- Executing: ['/usr/bin/python3', 'virtualenv.py', '--python', '/usr/bin/python3', '/home/vscode/lib/azure-cli']
Traceback (most recent call last):
File "/tmp/tmpfha73e2w/virtualenv-16.7.11/virtualenv.py", line 24, in
import distutils.spawn
ModuleNotFoundError: No module named 'distutils'
Traceback (most recent call last):
File "/tmp/azure_cli_install_tmp_wK6jl9", line 415, in
main()
File "/tmp/azure_cli_install_tmp_wK6jl9", line 399, in main
create_virtualenv(tmp_dir, install_dir)
File "/tmp/azure_cli_install_tmp_wK6jl9", line 144, in create_virtualenv
exec_command(cmd, cwd=working_dir)
File "/tmp/azure_cli_install_tmp_wK6jl9", 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/vscode/lib/azure-cli']' returned non-zero exit status 1.
@diberry ➜ /workspaces/cosmos-db-vector-samples (copilot/create-cosmos-db-vector-store) $ python --version
Python 3.12.12
```

### Expected behavior

No errors

### Environment Summary

Can't install so no value for this.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.