Home:ALL Converter>issue in installing pylibmodbus and cffi

issue in installing pylibmodbus and cffi

Ask Time:2019-05-17T18:24:48         Author:shan

Json Formatter

I am not able to install pylibmodbus library as cffi is not installed.
If I try to install cffi I get the following issue

pi@raspberrypi:~ $ pip3 install cffi Collecting cffi   Using cached https://files.pythonhosted.org/packages/93/1a/ab8c62b5838722f29f3daffcc8d4bd61844aa9b5f437341cc890ceee483b/cffi-1.12.3.tar.gz Collecting pycparser (from cffi)   Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.19-py2.py3-none-any.whl Building wheels for collected packages: cffi   Running setup.py bdist_wheel for cffi ... error   Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqz_612d/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpzpgl54b1pip-wheel- --python-tag cp35:   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 bdist_wheel   running build   running build_py   creating build   creating build/lib.linux-armv7l-3.5   creating build/lib.linux-armv7l-3.5/cffi  copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/model.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/error.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/verifier.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/lock.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/api.py
    -> build/lib.linux-armv7l-3.5/cffi   copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/__init__.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/recompiler.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/cparser.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/commontypes.py -> build/lib.linux-armv7l-3.5/cffi   copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.5/cffi   copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.5/cffi   copying cffi/_embedding.h -> build/lib.linux-armv7l-3.5/cffi   copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.5/cffi   running build_ext   building '_cffi_backend' extension   creating build/temp.linux-armv7l-3.5   creating build/temp.linux-armv7l-3.5/c   arm-linux-gnueabihf-gcc
    -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/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: pycparser, cffi   Running setup.py install for cffi ... error
        Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqz_612d/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-m_en9z1k-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
        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-3.5
        creating build/lib.linux-armv7l-3.5/cffi
        copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/model.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/error.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/verifier.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/lock.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/api.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/__init__.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/recompiler.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/cparser.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/commontypes.py -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/_embedding.h -> build/lib.linux-armv7l-3.5/cffi
        copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.5/cffi
        running build_ext
        building '_cffi_backend' extension
        creating build/temp.linux-armv7l-3.5
        creating build/temp.linux-armv7l-3.5/c
        arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/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/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqz_612d/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-m_en9z1k-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-pqz_612d/cffi/

Author:shan,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56184493/issue-in-installing-pylibmodbus-and-cffi
yy