AIX

 View Only
  • 1.  lxml For Python3

    Posted Wed June 16, 2021 11:38 AM
    Hello; we are running AIX 7.1 and need to add lxml to our Python3 installation.  If you have had success in doing this would you please share your steps? Thank-you in advance.

    ------------------------------
    Ed Stuart
    ------------------------------


  • 2.  RE: lxml For Python3

    Posted Thu June 17, 2021 05:14 PM
    Tried to install lxml-4.6.3 using Python pip and the source files. However, it fails and reports that it is missing two dependencies, the libxml2 and libxslt development packages.  However, rpm reports that both of these are installed. I do not have very much experience in this arena so any assistance would be much appreciated. 


    ------------------------------
    Ed Stuart
    ------------------------------



  • 3.  RE: lxml For Python3

    Posted Fri June 18, 2021 03:38 AM
    Please use AIX open source software forum for questions/issues related to open source and AIX toolbox.
    https://community.ibm.com/community/user/power/communities/community-home/digestviewer?communitykey=10c1d831-47ee-4d92-a138-b03f7896f7c9&tab=digestviewer

    I did not face any issue in installing lxml python module using pip.
    # python3 -m pip install lxml --no-cache-dir
    Collecting lxml
    Downloading lxml-4.6.3.tar.gz (3.2 MB)
    |################################| 3.2 MB 4.8 MB/s
    Using legacy setup.py install for lxml, since package 'wheel' is not installed.
    Installing collected packages: lxml
    Running setup.py install for lxml ... done
    Successfully installed lxml-4.6.3
    WARNING: You are using pip version 20.1.1; however, version 21.1.2 is available.
    You should consider upgrading via the '/opt/freeware/bin/python3 -m pip install --upgrade pip' command.

    # rpm -qa | grep python3
    python3-3.7.10-2.ppc
    python3-devel-3.7.10-2.ppc
    python3-tools-3.7.10-2.ppc

    # rpm -qa | grep libxml2
    libxml2-2.9.10-1.ppc
    libxml2-devel-2.9.10-1.ppc
    libxml2-python-2.9.10-1.ppc

    # rpm -qa | grep libxslt
    libxslt-1.1.32-1.ppc
    libxslt-devel-1.1.32-1.ppc





    ------------------------------
    SANKET RATHI
    ------------------------------



  • 4.  RE: lxml For Python3

    IBM Champion
    Posted Thu July 21, 2022 08:07 AM
    Sanket,

    I've previously been able to compile lxml on AIX 7.2 however now that I'm on 7.3 TL0 SP2 (different LPAR) I am seeing the following error so wonder how to overcome "XCOFF32 object files are not allowed in 64-bit mode"?

    # CC=gcc /opt/freeware/bin/python3 -m pip install lxml
    Collecting lxml
      Using cached lxml-4.9.1.tar.gz (3.4 MB)
      Preparing metadata (setup.py) ... done
    Using legacy 'setup.py install' for lxml, since package 'wheel' is not installed.
    Installing collected packages: lxml
      Running setup.py install for lxml ... error
      error: subprocess-exited-with-error
    
      Running setup.py install for lxml did not run successfully.
      exit code: 1
    
      [85 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against libxml2 2.9.14 and libxslt 1.1.34
      Building against libxml2/libxslt in one of the following directories:
        /opt/freeware/lib64
        /opt/freeware/lib
      running install
      running build
      running build_py
    . . . .
      creating build/temp.aix-7.3-3.7/src/lxml
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/opt/freeware/include/libxml2 -I/opt/freeware/include -Isrc -Isrc/lxml/includes -I/opt/freeware/include/python3.7m -c src/lxml/etree.c -o build/temp.aix-7.3-3.7/src/lxml/etree.o -w
      /opt/freeware/lib/python3.7/config-3.7m/ld_so_aix gcc -maix64 -fPIC -pthread -bI:/opt/freeware/lib/python3.7/config-3.7m/python.exp -L. -L/opt/freeware/lib/pthread/ppc64 -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib -Wl,-brtl -Wl,-blibpath:/opt/freeware/lib/pthread/ppc64:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib -L. -L/opt/freeware/lib/pthread/ppc64 -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib -Wl,-brtl -Wl,-blibpath:/opt/freeware/lib/pthread/ppc64:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib build/temp.aix-7.3-3.7/src/lxml/etree.o -L/opt/freeware/lib64 -L/opt/freeware/lib -L/opt/freeware/lib64 -lxslt -lexslt -lxml2 -lz -lm -o build/lib.aix-7.3-3.7/lxml/etree.so
      ld: 0711-738 ERROR: Input file build/temp.aix-7.3-3.7/src/lxml/etree.o:
              XCOFF32 object files are not allowed in 64-bit mode.
      collect2: error: ld returned 8 exit status
      error: command '/opt/freeware/lib/python3.7/config-3.7m/ld_so_aix' failed with exit status 1
      [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure
    
    Encountered error while trying to install package.
    
    lxml
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
    # ​

    Many thanks, Steve

    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------



  • 5.  RE: lxml For Python3

    Posted Thu July 21, 2022 10:42 AM

    The problem is with the setting of CC=gcc. 
    First, setting it is not needed and not recommended as python3 has it's own CC settings.
    Second, it has to be set as CC="gcc -maix64" as the default python3 is 64bit. 



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



  • 6.  RE: lxml For Python3

    IBM Champion
    Posted Thu July 21, 2022 11:14 AM
    Ayappan,

    I found I had to force the CC (maybe because I was actually invoking the AIX 7.3 python rather than the Open Source version) as it seemed to be trying to pick up xlc_r which we don't have.  I re-ran the compile as suggested, here's what I get.

    # /opt/freeware/bin/python3 -m pip install lxml
    Collecting lxml
      Using cached lxml-4.9.1.tar.gz (3.4 MB)
      Preparing metadata (setup.py) ... done
    Using legacy 'setup.py install' for lxml, since package 'wheel' is not installed.
    Installing collected packages: lxml
      Running setup.py install for lxml ... error
      error: subprocess-exited-with-error
    
      Running setup.py install for lxml did not run successfully.
      exit code: 1
    
      [89 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
    
    . . . . .
    
      gcc -maix64 -fPIC -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/opt/freeware/include/libxml2 -I/opt/freeware/include -Isrc -Isrc/lxml/includes -I/opt/freeware/include/python3.7m -c src/lxml/etree.c -o build/temp.aix-7.3-3.7/src/lxml/etree.o -w
      unable to execute 'gcc': No such file or directory
      Compile failed: command 'gcc' failed with exit status 1
      creating tmp
      cc -I/opt/freeware/include/libxml2 -I/opt/freeware/include -I/usr/include/libxml2 -c /tmp/xmlXPathInitr6lmjijx.c -o tmp/xmlXPathInitr6lmjijx.o
      unable to execute 'cc': No such file or directory
      error: command 'gcc' failed with exit status 1
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure
    
    Encountered error while trying to install package.
    
    lxml
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
    
    # rpm -qa | egrep 'libxml|libxslt'
    libxml2-2.9.14-1.ppc
    libxml2-devel-2.9.14-1.ppc
    libxslt-devel-1.1.34-1.ppc
    libxslt-1.1.34-1.ppc
    #
    
    ​

    So we're back at the xmlCheckVersion issue.

    Any guidance?

    Many thanks, Steve

    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------



  • 7.  RE: lxml For Python3

    Posted Thu July 21, 2022 11:52 AM
    I think your PATH variable doesn't have "/opt/freeware/bin" in it because of which it fails to find gcc. 
    And /opt/freeware/bin/python3 is AIX Toolbox python3 version only. 
    You can do "export PATH=/opt/freeware/bin:$PATH" and try. If you don't want to set it system wide, then do 
    PATH=/opt/freeware/bin:$PATH python3 -m pip install lxml

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



  • 8.  RE: lxml For Python3

    IBM Champion
    Posted Thu July 21, 2022 12:13 PM
    Ayappan,

    Ah, I know what's happened.

    We're migrating from 7.1 to 7.3, at 7.1 I had /opt/freeware/bin at the END of the PATH on 7.1 and that worked just fine.  Now we're at 7.3 the compile is finding things "before" getting to /opt/freeware/bin hence the issues.

    All sorted now, moved /opt/freeware/bin to the START of the PATH and success ::-)

    # python3 -m pip install lxml
    Collecting lxml
      Using cached lxml-4.9.1.tar.gz (3.4 MB)
      Preparing metadata (setup.py) ... done
    Using legacy 'setup.py install' for lxml, since package 'wheel' is not installed.
    Installing collected packages: lxml
      Running setup.py install for lxml ... done
    Successfully installed lxml-4.9.1
    WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
    #
    ​

    Many thanks, Steve

    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------