Home:ALL Converter>Not able to install cffi python package in AIX box

Not able to install cffi python package in AIX box

Ask Time:2019-08-08T22:16:03         Author:Arijit Das

Json Formatter

I am trying to install cffi package using pip for python 3.5 on AIX server, but it is failing with an error about xlc_r and also about not finding libffi package.

pip install cffi

ERROR: Command errored out with exit status 1:
     command: /path/to/my/venv/privpyenv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2x788gcb/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2x788gcb/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-6kyp6skh/install-record.txt --single-version-externally-managed --compile --install-headers /path/to/my/venv/privpyenv/include/site/python3.5/cffi
         cwd: /tmp/pip-install-2x788gcb/cffi/
    Complete output (68 lines):
    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
    unable to execute 'xlc_r': Not a directory
    unable to execute 'xlc_r': Not a directory

        No working compiler found, or bogus compiler options passed to
        the compiler from Python's standard "distutils" module.  See
        the error messages above.  Likely, the problem is not related
        to CFFI but generic to the setup.py of any Python package that
        tries to compile C code.  (Hints: on OS/X 10.8, for errors about
        -mno-fused-madd see http://stackoverflow.com/questions/22313407/
        Otherwise, see https://wiki.python.org/moin/CompLangPython or
        the IRC channel #python on irc.freenode.net.)

        Trying to continue anyway.  If you are trying to install CFFI from
        a build done in a different context, you can ignore this warning.

    running install
    running build
    running build_py
    creating build
    creating build/lib.aix-7.1-3.5
    creating build/lib.aix-7.1-3.5/cffi
    copying cffi/__init__.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/api.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/backend_ctypes.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/cffi_opcode.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/commontypes.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/cparser.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/error.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/ffiplatform.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/lock.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/model.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/pkgconfig.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/recompiler.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/setuptools_ext.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/vengine_cpy.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/vengine_gen.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/verifier.py -> build/lib.aix-7.1-3.5/cffi
    copying cffi/_cffi_include.h -> build/lib.aix-7.1-3.5/cffi
    copying cffi/parse_c_type.h -> build/lib.aix-7.1-3.5/cffi
    copying cffi/_embedding.h -> build/lib.aix-7.1-3.5/cffi
    copying cffi/_cffi_errors.h -> build/lib.aix-7.1-3.5/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.aix-7.1-3.5
    creating build/temp.aix-7.1-3.5/c
    xlc_r -DNDEBUG -O -I/opt/include -O2 -qmaxmem=-1 -qarch=pwr4 -q64 -I/opt/buildaix/includes -I/usr/include/ffi -I/usr/include/libffi -I/path/to/my/venv/privpyenv/include -I/opt/include/python3.5m -c c/_cffi_backend.c -o build/temp.aix-7.1-3.5/c/_cffi_backend.o
    unable to execute 'xlc_r': Not a directory
    error: command 'xlc_r' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /path/to/my/venv/privpyenv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2x788gcb/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2x788gcb/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-6kyp6skh/install-record.txt --single-version-externally-managed --compile --install-headers /path/to/my/venv/privpyenv/include/site/python3.5/cffi Check the logs for full command output.

Where I found libffi:

/opt/freeware/lib > ls -lrt | grep libffi
-rwxr-xr-x    1 root     system        25553 Nov 25 2014  libffi.so.6
-rwxr-xr-x    1 root     system        92378 Nov 25 2014  libffi.so.5
-rwxr-xr-x    1 root     system       250592 Nov 25 2014  libffi.a

I tried this http://www.rootvg.net/content/view/812/169/. Did not work. I am using python3.5 on AIX 7.1

Expecting suggestions about a fix here.

Author:Arijit Das,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/57414699/not-able-to-install-cffi-python-package-in-aix-box
yy