AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system


#Operatingsystems
#Opensource
#AIX
#AIX Open Source
 View Only
Expand all | Collapse all

Ansible: Could not import the dnf python module using /opt/freeware/bin/python3.9

  • 1.  Ansible: Could not import the dnf python module using /opt/freeware/bin/python3.9

    Posted Thu July 17, 2025 03:54 AM

    Hi,

    Have the following problem in ansible on AIX7.2 only. Works fine on AIX7.3

    fatal: [myhost]: FAILED! => {"changed": false, "msg": "Could not import the dnf python module using /opt/freeware/bin/python3.9 (3.9.22 (main, May  5 2025, 07:00:37) [GCC 10.3.0]). Please install `python3-dnf` or `python2-dnf` package or ensure you have specified the correct ansible_python_interpreter. (attempted ['/usr/libexec/platform-python', '/usr/bin/python3', '/usr/bin/python2', '/usr/bin/python'])", "results": []}

    Testing with python3 (python3.9-3.9.22)

    /opt/freeware/bin# python3
    Python 3.9.22 (main, May  5 2025, 07:00:37)
    [GCC 10.3.0] on aix
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import dnf
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/opt/freeware/lib/python3.9/site-packages/dnf/__init__.py", line 30, in <module>
        import dnf.base
      File "/opt/freeware/lib/python3.9/site-packages/dnf/base.py", line 29, in <module>
        import libdnf.transaction
      File "/opt/freeware/lib/python3.9/site-packages/libdnf/__init__.py", line 3, in <module>
        from . import common_types
      File "/opt/freeware/lib/python3.9/site-packages/libdnf/common_types.py", line 13, in <module>
        from . import _common_types
    ImportError: Could not load module /opt/freeware/lib/python3.9/site-packages/libdnf/_common_types.so.
    System error: Exec format error

    I checked the /opt/freeware/lib/python3.9/site-packages/libdnf/_common_types.so

    # ldd /opt/freeware/lib/python3.9/site-packages/libdnf/_common_types.so
    /opt/freeware/lib/python3.9/site-packages/libdnf/_common_types.so needs:
             /opt/freeware/lib/libgcc_s.a(shr.o)
             /usr/lib/libc.a(shr.o)
             /usr/lib/libpthreads.a(shr_comm.o)
             /opt/freeware/lib/libpython3.9.a(libpython3.9.so)
             /opt/freeware/lib/libstdc++.a(libstdc++.so.6)
             /opt/freeware/lib/libzstd.a(libzstd.so.1)
             /opt/freeware/lib/libgmodule-2.0.a(libgmodule-2.0.so.0)
             /opt/freeware/lib/libffi.a(libffi.so.8)
             /opt/freeware/lib/libiconv.a(libiconv.so.2)
             /opt/freeware/lib/libsqlite3.a(libsqlite3.so.0)
             /opt/freeware/lib/libsmartcols.a(libsmartcols.so.1)
             /opt/freeware/lib/libmodulemd.a(libmodulemd.so.1)
             /opt/freeware/lib/librepo.a(librepo.so.0)
             /opt/freeware/lib/libcheck.a(libcheck.so.0)
             /opt/freeware/lib/libdnf.a(libdnf.so.2)
             /opt/freeware/lib/libgio-2.0.a(libgio-2.0.so.0)
             /opt/freeware/lib/libgobject-2.0.a(libgobject-2.0.so.0)
             /opt/freeware/lib/libglib-2.0.a(libglib-2.0.so.0)
             /opt/freeware/lib/libintl.a(libintl.so.8)
             /opt/freeware/lib/libsolv.a(libsolv.so.1)
             /opt/freeware/lib/libsolvext.a(libsolvext.so.1)
             /opt/freeware/lib/libjson-c.a(libjson-c.so.5)
             /opt/freeware/lib/libgpgme.a(libgpgme.so.11)
             /opt/freeware/lib/libgpg-error.a(libgpg-error.so.0)
             /unix
             /usr/lib/libcrypt.a(shr.o)
             /usr/lib/libpthreads.a(shr_xpg5.o)
             /usr/lib/libdl.a(shr.o)
             /usr/lib/libpthread.a(shr_xpg5.o)
             /opt/freeware/lib/libyaml.a(libyaml-0.so.2)
             /opt/freeware/lib/libzck.a(libzck.so.1)
             /opt/freeware/lib/libxml2.a(libxml2.so.2)
             /opt/freeware/lib/libcurl.a(libcurl.so.4)
             /usr/lib/libcrypto.a(libcrypto.so.1.1)
             /usr/opt/rpm/lib/librpm.a(librpm.so.9)
             /usr/opt/rpm/lib/librpmio.a(librpmio.so.9)
             /opt/freeware/lib/libz.a(libz.so.1)
             /opt/freeware/lib/libatomic.a(libatomic.so.1)
             /opt/freeware/lib/libpcre2-8.a(libpcre2-8.so.0)
             /opt/freeware/lib/libbz2.a(libbz2.so.1)
             /usr/lib/librtl.a(shr.o)
             /opt/freeware/lib/liblzma.a(liblzma.so.5)
             /opt/freeware/lib/libassuan.a(libassuan.so.0)
             /opt/freeware/lib/libnghttp2.a(libnghttp2.so.14)
             /opt/freeware/lib/libssh2.a(libssh2.so.1)
             /opt/freeware/lib/libgssapi_krb5.a(libgssapi_krb5.so)
             /opt/freeware/lib/libkrb5.a(libkrb5.so)
             /opt/freeware/lib/libk5crypto.a(libk5crypto.so)
             /opt/freeware/lib/libcom_err.a(libcom_err.so)
             /opt/freeware/lib/liblber.a(liblber-2.5.so.0)
             /opt/freeware/lib/libldap.a(libldap-2.5.so.0)
             /usr/lib/libcrypto.a(libcrypto.so.3)
             /usr/lib/libssl.a(libssl.so.3)
             /usr/opt/rpm/lib/libintl.a(libintl.so.8)
             /usr/opt/rpm/lib/liblua.a(liblua-5.3.so)
             /usr/opt/rpm/lib/libdb-4.8.a(libdb-4.8.so)
             /usr/opt/rpm/lib/libpopt.a(libpopt.so.0)
             /usr/opt/rpm/lib/libnss3.a(libnss3.so)
             /usr/opt/rpm/lib/libbz2.a(libbz2.so.1)
             /usr/opt/rpm/lib/libz.a(libz.so.1)
             /opt/freeware/lib/libkrb5.so
             /opt/freeware/lib/libk5crypto.so
             /opt/freeware/lib/libcom_err.so
             /opt/freeware/lib/libkrb5support.so
             /opt/freeware/lib/libsasl2.a(libsasl2.so.3)
             /usr/lib/libs.a(shr.o)
             /opt/freeware/lib/libnspr4.so
             /opt/freeware/lib/libnssutil3.so
             /opt/freeware/lib/libplc4.so
             /opt/freeware/lib/libplds4.so
             /usr/lib/libodm.a(shr.o)
             /usr/lib/libcfg.a(shr.o)
             /usr/lib/libc_r.a(shr.o)



    ------------------------------
    Paul Clayton
    ------------------------------


  • 2.  RE: Ansible: Could not import the dnf python module using /opt/freeware/bin/python3.9

    Posted Thu July 17, 2025 07:12 AM

    For AIX 7.2/7.1, use "/opt/freeware/libexec/python3.9_32" as the python interpreter in ansible for importing dnf modules. This is because rpm (rpm.rte) is 32-bit in AIX 7.2 and below levels. 



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