0

I'm working on raspberry pi (running raspbian stretch) and I would like to install the azure-cli tool.

I followed this tutorial: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest which explains how to install the azure-cli manually.

I have the prerequisites (docker, libffi and openssl).

But when I run this command:

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

I have the following error:

c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
                ^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------
Command "/home/pi/lib/azure-cli/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-AymY3d/cffi/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-GwBn9T/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-7GqUCB/overlay --compile --install-headers /home/pi/lib/azure-cli/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-install-AymY3d/cffi/

----------------------------------------
Command "/home/pi/lib/azure-cli/bin/python /home/pi/lib/azure-cli/local/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-7GqUCB/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- setuptools>=18.5 wheel "cffi>=1.8,!=1.11.3; python_implementation != 'PyPy'"" failed with error code 1 in None
Traceback (most recent call last):
  File "/tmp/azure_cli_install_tmp_N09j1y", line 370, in <module>
    main()
  File "/tmp/azure_cli_install_tmp_N09j1y", line 356, in main
    install_cli(install_dir, tmp_dir)
  File "/tmp/azure_cli_install_tmp_N09j1y", line 140, in install_cli
    exec_command(cmd)
  File "/tmp/azure_cli_install_tmp_N09j1y", 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 '['/home/pi/lib/azure-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpD9EVQQ', 'azure-cli', '--upgrade']' returned non-zero exit status 1

The first part of the error (with ffi.h) appears several times.

I need some help to solve this issue. Thanks

2 Answers 2

1

I found the solution.

First I downloaded this script:

$ curl -L https://aka.ms/InstallAzureCli >> installAzureCli.sh

Then from this script I downloaded the python script:

$ curl https://azurecliprod.blob.core.windows.net/install.py >> installAzureCliPython.py

And finally I ran this script:

$ sudo chmod +x installAzureCliPython.py
$ python3 installAzureCliPython.py

It works. I checked with az login.

Sign up to request clarification or add additional context in comments.

Comments

0

For the issue you got, I think it's the problem of your environment. Well, you can download the script to a local shell script and see what it needs. Download it like this:

curl -L https://aka.ms/InstallAzureCli >> installAzureCli.sh

And the installing like this:

enter image description here

It seems the installation is dependant on the python pip. Or you can download the install script directly with the command:

curl https://azurecliprod.blob.core.windows.net/install | bash

But I suggest you should check first if your environment is already to install it.

7 Comments

I have Python 2.7.13 and Python 3.5.3 installed. I also have pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7) and pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5). Everything seems to be good, no ?
@iAmoric Yeah, it seems everything is OK. Maybe you can try the second command.
For the error about ffi.h, I checked if libffi is installed and I have libffi.so.6 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libffi.so.6. I think it's ok but just to be sure..
@iAmoric Well, as the document says the CLI requires the following software Python 3.6.x or 3.7.x. libffi and OpenSSL 1.0.2. So you should make sure all these are already. It seems the script cannot find the ffi.h from the error. Or without the permission to find it.
I don't know how to check for libffi. I did ldconfig | grep libffi and I got libffi.so.6 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libffi.so.6. For openssl I have 1.1.0
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.