-
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
[Doc] Add doc for installing Azure CLI with pip #20476
Comments
[draft version] Install Azure CLI with pipAzure CLI is built on Python. The supported Python versions are 3.7 ~ 3.10. Directly running WindowsInstallFirst install Python from https://www.python.org/downloads/windows/. Then launch a PowerShell terminal and run: # Create a virtual environment
python -m venv azure-cli-env
# Update pip
azure-cli-env\Scripts\python.exe -m pip install --upgrade pip
# Install azure-cli
azure-cli-env\Scripts\python.exe -m pip install azure-cli
# Run any Azure CLI commands
azure-cli-env\Scripts\az --version UninstallDelete the virtual environment: Remove-Item -Force -Recurse azure-cli-env Linux/MacOSInstallFirst make sure # Ubuntu/Debian
sudo apt install python3 python3-venv --yes
# Fedora/CentOS/RHEL
sudo dnf install python3 -y
# Homebrew
brew install python Then continue the installation: # Create a virtual environment
python3 -m venv azure-cli-env
# Update pip
azure-cli-env/bin/python -m pip install --upgrade pip
# Install azure-cli
azure-cli-env/bin/python -m pip install azure-cli
# Run any Azure CLI commands
azure-cli-env/bin/az --version UninstallDelete the virtual environment: rm -rf azure-cli-env Reference |
pip install azure-cli
@jiasli , where is this information ultimately going to reside? |
@dbradish-microsoft, I am not sure. Actually some customers and I are a little bit concerned about the compliance/security of PyPI. Let's discuss about this internally first. |
@jiasli If you think some customers are concerned about PyPI ... wait till they start discussing HomeBrew ! HomeBrew is not considered an acceptable solution by InfoSec in any of the last four environments I've worked in, all four have been Microsoft customers using, or looking to use Azure in some way. You need to figure out a way to package the CLI tools for macOS using accepted platform standards. |
Anyway, I noted it on my blog for posterity and ease me when I want to remember how to do: https://mihamina.rktmb.org/2023/06/azurecli-custom-python.html |
@rakotomandimby Thanks for your blog post. It helped me to fix my setup! I also edited the So my workaround is to always activate the virtualenv and then I also switched to my system python binary instead of the bundled one from the cli.
I run into this issue because I use a gentoo based system where your packages are not available. I'll try to create an ebuild (gentoo package) to install it the right way if I find the time. @jiasli Just as an FYI. If the intended solution is a For example gentoo greets you with the following error if you try to install a package via pip outside of the package manager.
|
@tkaepp, thanks for the information, but Gentoo Linux is not an officially supported system. The
Could you provide more information on this?
Azure CLI didn't bundle python binary. That If you install Azure CLI in a virtual environment, the 1. Call
2. Activate the virtual environment 3. Add |
Please consider supporting Windows ARM as official package, this workaround using Python is tedious to be frank. What I had to do is, open powershell, install Python 3.12, run this modified script (not the same as above) Create a virtual environmentpython3 -m venv azure-cli-env Update pipazure-cli-env/bin/python -m pip install --upgrade pip Install azure-cliazure-cli-env/bin/python -m pip install azure-cli azure-cli-env/bin/python -m pip install setuptools and after that notepad $profile, write: and restart the Powershell, now it seems to work at least for az --version, haven't tested more deeply yet. |
There are platforms or architectures where we don't officially distribute native packages:
The solution is to install
azure-cli
from PyPI: https://pypi.org/project/azure-cli/We do have the doc https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=script which is internally using
pip
to installazure-cli
. It calls https://github.com/Azure/azure-cli/blob/dev/scripts/curl_install_pypi/install which then calls https://github.com/Azure/azure-cli/blob/dev/scripts/curl_install_pypi/install.py.However, this method is
azure-cli/scripts/curl_install_pypi/install.py
Lines 366 to 367 in 50ccb24
The text was updated successfully, but these errors were encountered: