0

The OS running on the Pi is Raspbian 9.8, I'm trying to do the

sudo pip install --pre azure 

So I can send images from my Pi to my blob storage on azure but when I run the above command it begins to install fine until it gets to the ffi.h part and then in red writing it says "Failed building wheel for cffi" as shown in the code.

pi@raspberrypi:~ $ sudo pip install --pre azure

Part of the output is

    building '_cffi_backend' extension
    creating build/temp.linux-armv7l-2.7
    creating build/temp.linux-armv7l-2.7/c
    arm-linux-gnueabihf-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-Ub3vap/python2.7-2.7.13=. -fstack-
    protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -
    DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
  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

  ----------------------------------------
  Failed building wheel for cffi
  Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: cffi, scandir, pathlib2, azure-datalake-store, azure-servicebus, azure-storage-queue, azure-mgmt-nspkg, azure-mgmt-keyvault, azure-mgmt-logic, azure-mgmt-subscription, azure-mgmt-redis, azure-mgmt-containerservice, azure-mgmt-datalake-nspkg, azure-mgmt-datalake-analytics, azure-mgmt-loganalytics, azure-mgmt-hanaonazure, azure-mgmt-devspaces, azure-mgmt-maps, azure-mgmt-recoveryservicesbackup, azure-mgmt-applicationinsights, azure-mgmt-scheduler, azure-mgmt-network, azure-mgmt-devtestlabs, azure-mgmt-eventhub, azure-mgmt-reservations, azure-mgmt-servicebus, azure-mgmt-notificationhubs, azure-mgmt-eventgrid, azure-mgmt-iotcentral, azure-mgmt-billing, azure-mgmt-datafactory, azure-mgmt-commerce, azure-mgmt-storage, azure-mgmt-resource, azure-mgmt-iothubprovisioningservices, azure-mgmt-batchai, azure-mgmt-trafficmanager, azure-mgmt-marketplaceordering, azure-mgmt-machinelearningcompute, azure-mgmt-managementgroups, azure-mgmt-monitor, azure-mgmt-powerbiembedded, azure-mgmt-msi, azure-mgmt-cognitiveservices, azure-mgmt-compute, azure-mgmt-search, azure-mgmt-advisor, azure-mgmt-managementpartner, azure-mgmt-consumption, azure-mgmt-datalake-store, azure-mgmt-media, azure-mgmt-batch, azure-mgmt-containerregistry, azure-mgmt-cdn, azure-mgmt-containerinstance, azure-mgmt-relay, azure-mgmt-dns, azure-mgmt-signalr, azure-mgmt-policyinsights, azure-mgmt-authorization, azure-mgmt-rdbms, azure-mgmt-servicefabric, azure-mgmt-sql, azure-mgmt-web, azure-mgmt-cosmosdb, azure-mgmt-iothub, azure-mgmt-recoveryservices, azure-mgmt-datamigration, azure-mgmt, azure-applicationinsights, azure-keyvault, azure-storage-blob, azure-batch, azure
  Running setup.py install for cffi ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tNlbDT/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-BKywpl-record/install-record.txt --single-version-externally-managed --compile:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-2.7
    creating build/lib.linux-armv7l-2.7/cffi
    copying cffi/cparser.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/commontypes.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/lock.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/recompiler.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/error.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/pkgconfig.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/model.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/verifier.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/api.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/__init__.py -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/_embedding.h -> build/lib.linux-armv7l-2.7/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-2.7/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-armv7l-2.7
    creating build/temp.linux-armv7l-2.7/c
    arm-linux-gnueabihf-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-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
    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 "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tNlbDT/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-BKywpl-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-tNlbDT/cffi/
1

Wheels are pre-built for Python 3 (see piwheels.org) so I'd recommend using that:

sudo pip3 install cffi

Python 2 EOL is approaching too.

1

ciffi depends on libffi, so I had to first install the libffi-dev package. Install it using:

sudo apt install libffi-dev

The package might be different if you are using some other distro.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.