-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot install azure cli on macOS via script - virtualenv error #22345
Comments
@jiasli for awareness |
I can reproduce this, seems like a compatibility problem of Can we replace |
@bebound Is there currently a way to install Azure CLI via bash script without package manager like pip or homebrew |
I don't think there is a simpler way to do so on macOS. |
Would it be possible to make an update so that via a bash script you can install Azure CLI directly on macOS without package manager. |
python3 -m venv azure-cli-env
azure-cli-env/bin/python -m pip install --upgrade pip
azure-cli-env/bin/python -m pip install wheel
azure-cli-env/bin/python -m pip install azure-cli This script is modified from the guide above. |
Thanks for the help. Your procedure is a local installation. Is there also the possibility to install Azure globally on Mac like on Windows? If not, the ticket can be closed. I can work with your suggestion. |
Unfortunately, brew package is the only way to install CLI globally on Mac. |
Counter question... is there a way to install Azure CLI for Windows locally without Python? Are there installation urls to ZIP files? |
As root, we will install Azure CLI (system-wide) in /usr/local rather than in a non-privileged user context (~/) yourhost:~ yourlogin$ sudo -s -H Enter your session password to get a session in the root user's context. Check your environment, e.g. on macOS Ventura (13.0) : bash-3.2# uname -v If needed, install Xcode Command Line Tools (or Xcode from the App Store) : A window "Install Command Line Developer Tools" will pop up; click "Install" and "Agree" the license agreement. This will trigger the download for the required software and install the command line tools in /Library/Developer/CommandLineTools. Install/Update Python package installer (pip) : Install Python virtual environment manager (virtualenv) : Check your version of virtualenv : Prepare temporary environment and get Azure CLI installation script : Download the Azure CLI installation script : Edit the install.py script to prevent the installation of a problematic virtualenv version that the script wants - see attached file install.py.zip. #working_dir = os.path.join(tmp_dir, virtualenv_dir_name) Launch the installation with : You will be asked the two following questions : ===> In what directory would you like to place the 'az' executable? (leave blank to use '/usr/local/bin'): The script will then download and install all the Azure CLI modules/packages : [...] Installing collected packages: urllib3-secure-extra, jsondiff, invoke, chardet, azure-nspkg, azure-common, argcomplete, applicationinsights, antlr4-python3-runtime, xmltodict, wrapt, websocket-client, urllib3, typing-extensions, tabulate, six, semver, pyyaml, PySocks, pyparsing, PyMySQL, PyJWT, pygments, pycparser, psutil, portalocker, pkginfo, oauthlib, jmespath, idna, humanfriendly, colorama, charset-normalizer, certifi, bcrypt, azure-mgmt-nspkg, requests, python-dateutil, pathlib2, packaging, knack, javaproperties, isodate, deprecated, cffi, azure-mgmt-datalake-nspkg, azure-cli-telemetry, requests-oauthlib, PyNaCl, cryptography, azure-cosmos, azure-core, pyopenssl, PyGithub, paramiko, msrest, azure-storage-common, azure-mgmt-core, adal, sshtunnel, scp, msrestazure, msal, fabric, azure-synapse-spark, azure-synapse-managedprivateendpoints, azure-synapse-artifacts, azure-synapse-accesscontrol, azure-multiapi-storage, azure-mgmt-web, azure-mgmt-trafficmanager, azure-mgmt-synapse, azure-mgmt-storage, azure-mgmt-sqlvirtualmachine, azure-mgmt-sql, azure-mgmt-signalr, azure-mgmt-servicelinker, azure-mgmt-servicefabricmanagedclusters, azure-mgmt-servicefabric, azure-mgmt-servicebus, azure-mgmt-security, azure-mgmt-search, azure-mgmt-resource, azure-mgmt-redis, azure-mgmt-redhatopenshift, azure-mgmt-recoveryservicesbackup, azure-mgmt-recoveryservices, azure-mgmt-rdbms, azure-mgmt-privatedns, azure-mgmt-policyinsights, azure-mgmt-network, azure-mgmt-netapp, azure-mgmt-msi, azure-mgmt-monitor, azure-mgmt-media, azure-mgmt-marketplaceordering, azure-mgmt-maps, azure-mgmt-managementgroups, azure-mgmt-loganalytics, azure-mgmt-keyvault, azure-mgmt-iothubprovisioningservices, azure-mgmt-iothub, azure-mgmt-iotcentral, azure-mgmt-imagebuilder, azure-mgmt-hdinsight, azure-mgmt-extendedlocation, azure-mgmt-eventhub, azure-mgmt-eventgrid, azure-mgmt-dns, azure-mgmt-datamigration, azure-mgmt-databoxedge, azure-mgmt-cosmosdb, azure-mgmt-containerservice, azure-mgmt-containerregistry, azure-mgmt-containerinstance, azure-mgmt-compute, azure-mgmt-cognitiveservices, azure-mgmt-cdn, azure-mgmt-botservice, azure-mgmt-billing, azure-mgmt-batchai, azure-mgmt-batch, azure-mgmt-applicationinsights, azure-mgmt-appconfiguration, azure-mgmt-apimanagement, azure-mgmt-advisor, azure-loganalytics, azure-keyvault-keys, azure-keyvault-administration, azure-datalake-store, azure-data-tables, azure-appconfiguration, msal-extensions, azure-mgmt-relay, azure-mgmt-managedservices, azure-mgmt-kusto, azure-mgmt-devtestlabs, azure-mgmt-deploymentmanager, azure-mgmt-datalake-store, azure-mgmt-datalake-analytics, azure-mgmt-consumption, azure-mgmt-authorization, azure-keyvault, azure-graphrbac, azure-batch, azure-cli-core, azure-cli At the end, you will be asked if you want to update your $PATH environment variable : ===> Could not automatically find a suitable file to use. Create /var/root/.bash_profile now? (Y/n): Y The installation is now done. The final step will consist in the modification of your .bash_profile to add these two lines (accordingly to your previous choices concerning the installation paths), e.g. : export PATH=$PATH:/usr/local/bin Exit the root session and test an az command, for instance : yourhost:~ yourlogin$ which az or yourhost:~ yourlogin$ az version Clean up the temporary installation directory : Enjoy ! |
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.
The text was updated successfully, but these errors were encountered: