Describe the bug
Unable to install az via apt when using official install instructions for Linux.
To reproduce
Follow instructions in the document: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
_Add Microsoft signing key._
_Execute:_
curl -sL https://packages.microsoft.com/keys/microsoft.asc |
gpg --dearmor |
sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null
_Result: OK_
_Add microsoft repo_
_Execute:_
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list
_Result: OK_
Correct file exists /etc/apt/sources.list.d/azure-cli.list
Repo definition exists: deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ stable main
_Perform apt update_
Execute: sudo apt-get update
Output:
Err:4 https://packages.microsoft.com/repos/azure-cli stable/main amd64 Packages
404 Not Found
Reading package lists... Done
W: The repository 'https://packages.microsoft.com/repos/azure-cli stable Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://packages.microsoft.com/repos/azure-cli/dists/stable/main/binary-amd64/Packages 404 Not Found
Expected behavior
Successfully update package lists from source repo.
Environment summary
4.15.0-30 deepin-generic
Current Azure CLI apt install only supports LTS versions of Ubuntu and Debian. Can you try with https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest?
@fengzhou-msft I understand about the support, yet a lot of distros are based on those two so I had hoped it is going to work in the same way.
When it comes to the link you sent, the script downloaded successfully and started executing but got this error:
Initially I thought it might be permissions issue but executing as root does result in the same error.
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/az-cli/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-DgSLLa/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-DgSLLa/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-JtwVg2/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/bin/az-cli/include/site/python2.7/psutil
cwd: /tmp/pip-install-DgSLLa/psutil/
Complete output (44 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
creating build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/psutil
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=565 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/az-cli/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-DgSLLa/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-DgSLLa/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-JtwVg2/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/bin/az-cli/include/site/python2.7/psutil Check the logs for full command output.
Traceback (most recent call last):
File "/tmp/azure_cli_install_tmp_fqgCxr", line 370, in <module>
main()
File "/tmp/azure_cli_install_tmp_fqgCxr", line 356, in main
install_cli(install_dir, tmp_dir)
File "/tmp/azure_cli_install_tmp_fqgCxr", line 140, in install_cli
exec_command(cmd)
File "/tmp/azure_cli_install_tmp_fqgCxr", line 100, in exec_command
subprocess.check_call(command_list, cwd=cwd, env=env)
File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/az-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpjiOe1r', 'azure-cli', '--upgrade']' returned non-zero exit status 1
Please install libssl-dev, libffi-dev, python-dev, build-essential before running the script. These are the requirement for debian using the script. It may also apply to deepin-generic.
Found a similiar issue: https://github.com/MicrosoftDocs/azure-docs-cli/issues/1628. If you know the debian system that is close to yours, you could replace AZ_REPO=$(lsb_release -cs) with something like AZ_REPO=stretch in step 3 of https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
Close due to inactivity. Feel free to reopen the issue if you still have installation problems.
Faced the same issue as @techspeque, with bionic release. Solution, in my situation, was to get to https://packages.microsoft.com/repos/azure-cli/pool/main/a/azure-cli/ and download .deb package for proper debian release (bionic in my case) and install with package manager. However, before I did install (libssl-dev, libffi-dev, python-dev, build-essential) manually. )
Most helpful comment
Found a similiar issue: https://github.com/MicrosoftDocs/azure-docs-cli/issues/1628. If you know the debian system that is close to yours, you could replace
AZ_REPO=$(lsb_release -cs)with something likeAZ_REPO=stretchin step 3 of https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest