Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
  • 1.  libcffi issue installing package via pip

    Posted Tue January 16, 2024 07:15 PM

    Hello,

    I am on AIX 73 with the latest dnf. I have installed:

    # dnf list | egrep -i ffi
    libffi.ppc                                        3.4.4-2          @AIX_Toolbox
    libffi-devel.ppc                                  3.4.4-2          @AIX_Toolbox
    python3-cffi.ppc                                  1.13.2-2         @AIX_Toolbox
    python3.9-cffi.ppc                                1.13.2-2         @AIX_Toolbox

    When I install a package via pip3, I get the following errors:

    Collecting pynacl>=1.5 (from paramiko>=1.12->ReviewBoard)
      Using cached PyNaCl-1.5.0.tar.gz (3.4 MB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... error
      error: subprocess-exited-with-error

      Preparing metadata (pyproject.toml) did not run successfully.
      exit code: 1

      [38 lines of output]
      Traceback (most recent call last):
        File "/usr/opt/python3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/opt/python3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/opt/python3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 202, in <module>
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 303, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 283, in __init__
          self.finalize_options()
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 654, in finalize_options
          ep(self)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 674, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "src/bindings/build.py", line 35, in <module>
          ffi = FFI()
        File "/tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__
          import _cffi_backend as backend
      ImportError:    0509-022 Cannot load module /tmp/pip-build-env-ec4edbc1/overlay/lib/python3.9/site-packages/_cffi_backend.cpython-39.so.
              0509-150   Dependent module libffi.a(libffi.so.8) could not be loaded.
              0509-022 Cannot load module libffi.a(libffi.so.8).
              0509-026 System error: A file or directory in the path name does not exist.
      [end of output]

    I have contacted the package owner and they feel this is a libffi issue. Looking at the libffi.a library, I see libffi.so.8 is there:

    # ar -X any -t /opt/freeware/lib/libffi.a
    libffi.so.8
    libffi.so.8
    libffi.so.6
    libffi.so.6

    Although it does seem odd to see 2 of the same module listed. 

    Any ideas/suggestions?

    Thanks - Grover



    ------------------------------
    Grover Davidson
    ------------------------------

    #AIXOpenSource


  • 2.  RE: libcffi issue installing package via pip

    Posted Wed January 17, 2024 02:29 AM

    From the output, it seems AIX 7.3 base Python (/usr/opt/python3) is used rather than Toolbox Python. AIX base Python will not work with AIX Toolbox packages (can work with some hacks but it would be a mess). I would recommend you to use python3 or pip3 from /opt/freeware/bin path.



    ------------------------------
    Ayappan P
    ------------------------------