Skip to content

Cannot install azure cli on macOS via script - virtualenv error #22345

@alfeilex

Description

@alfeilex

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

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

Describe the bug
To install Azure CLI on MacOS, I would like to use a bash script and not a package manager like homebrew as recommend in the Azure CLI Docs. I have used the following instructions to setup Azure CLI via script.
Installation with Script

During the installation of azure cli with the previous related command and error occured that is related with virtualenv variable of Python.

To Reproduce
Start the installation with related command on macOS and make sure that the requirements are met before installation.

Expected behavior
The installation process should run without errors.

Environment summary
Interactive script executed by Terminal on MacOS High Sierra | az --version > 2.36.0

Additional context
The only way to fix the error was to install virtualenv with conda.
conda install virtualenv

Here is the error message.

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

===> In what directory would you like to place the 'az' executable? (leave blank to use '/Users/root1/bin'): 
-- The executable will be in '/Users/root1/bin'.
-- Downloading virtualenv package from https://pypi.python.org/packages/source/v/virtualenv/virtualenv-16.7.11.tar.gz.

-- Downloaded virtualenv package to /var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/tmpoeiop18y/virtualenv-16.7.11.tar.gz.
-- Checksum of /var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/tmpoeiop18y/virtualenv-16.7.11.tar.gz OK.
-- Extracting '/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/tmpoeiop18y/virtualenv-16.7.11.tar.gz' to '/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/tmpoeiop18y'.
-- Executing: ['/Library/Frameworks/Python.framework/Versions/3.10/bin/python3', 'virtualenv.py', '--python', '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3', '/Users/root1/lib/azure-cli']
/private/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/tmpoeiop18y/virtualenv-16.7.11/virtualenv.py:24: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.spawn
/private/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/tmpoeiop18y/virtualenv-16.7.11/virtualenv.py:25: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
  import distutils.sysconfig
Already using interpreter /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.10'
New python executable in /Users/root1/lib/azure-cli/bin/python3
Also creating executable in /Users/root1/lib/azure-cli/bin/python
ERROR: The executable /Users/root1/lib/azure-cli/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.10' (should be '/Users/root1/lib/azure-cli')
ERROR: virtualenv is not compatible with this system or executable
Traceback (most recent call last):
  File "/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/azure_cli_install_tmp_XXXXXX.9JI5cENc", line 415, in <module>
    main()
  File "/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/azure_cli_install_tmp_XXXXXX.9JI5cENc", line 399, in main
    create_virtualenv(tmp_dir, install_dir)
  File "/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/azure_cli_install_tmp_XXXXXX.9JI5cENc", line 144, in create_virtualenv
    exec_command(cmd, cwd=working_dir)
  File "/var/folders/9w/sj6bkvbd7p3dzj9fxtvx9vqm0000gn/T/azure_cli_install_tmp_XXXXXX.9JI5cENc", line 105, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.10/bin/python3', 'virtualenv.py', '--python', '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3', '/Users/root1/lib/azure-cli']' returned non-zero exit status 100.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions