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

 View Only
  • 1.  Will the real python3.9 please stand up?!

    Posted Wed October 25, 2023 11:08 AM

    We currently have two main requirements for python on AIX: 1) cloud-init (for PowerVC deployments) and 2) Ansible automation. We are having a difficult time getting our Automation Team to specify exactly which version/libraries of python they require/support for Ansible automation. In the mean time, I have been testing cloud-init-22.1-5.noarch with it's own RPM requisite python3.9-3.9.18-1.ppc. Now python3.9 is also included with AIX 7.3.1.2 as a LPP: python3.9.base 3.9.12.0. (BTW, in our post customization, we update this package to 3.9.18, I believe) But neither seem to be configured as the AIX "default" for "python" in our default PATH, at all. AIX 7.3.1.2 seems to be configured by "default" to have "python3" point to the LPP package in our PATH. So is the "python" executable considered to be deprecated now? Is there any reason that I should have/maintain two different python3.9 packages in AIX 7.3.1.2?



    ------------------------------
    Mackey Morgan
    ------------------------------


  • 2.  RE: Will the real python3.9 please stand up?!

    Posted Thu October 26, 2023 09:12 AM

    Given that python3 was expected to be incompatible with python2, the usage of "python" was deprecated leaving your scripts to specify "python2" or "python3".

    On an AIX 7.3, if you type "python3" you get nothing ?



    ------------------------------
    José Pina Coelho
    IT Specialist at Kyndryl
    ------------------------------



  • 3.  RE: Will the real python3.9 please stand up?!

    Posted Mon October 30, 2023 10:02 AM

    Hi Jose! I think I inadvertently combined two questions into one post. My primary question is regarding the ramifications of having two disparate python3.9 packages on my AIX servers--one as a LPP (python3.9.base) included with AIX 7.3.1.2 and the other installed as an RPM (python3.9-3.9.18-1.ppc) requisite for cloud-init. Since I have NOT included /opt/freeware/bin in my PATH at all, the ONLY python3 that will ever be called from the CLI would be the AIX native LPP:

    # ls -l /usr/bin/python3
    lrwxrwxrwx    1 root     system           30 Oct 26 15:16 /usr/bin/python3 -> /usr/opt/python3/bin/python3.9

    # ls -l /usr/opt/python3/bin/python3.9
    -rwxr-xr-x    1 root     system       222119 Jun 21 05:33 /usr/opt/python3/bin/python3.9

    # ls -l /opt/freeware/bin/python3.9
    -rwxr-xr-x    1 root     system       189332 Sep 19 03:00 /opt/freeware/bin/python3.9

    I suppose I could tack ":/opt/freeware/bin" to the end of my PATH, but so long as ":/usr/bin" has precedence in my PATH, it wouldn't change anything.

    I think your response touched on another question that I have, namely whether there should also be a /usr/bin/python linked to /usr/opt/python3/bin/python3.9, as well as /usr/bin/python3. I think you have answered that question for me (i.e. "python", which is python2, is "deprecated" or "disallowed" or "unsupported" from this AIX release forward.).



    ------------------------------
    Mackey Morgan
    ------------------------------



  • 4.  RE: Will the real python3.9 please stand up?!

    Posted Mon October 30, 2023 03:39 PM

    I believe the intention with the LPP version is that it's only to be used with IBM provided products.  You never know when they'll decide to swap out 3.9 for a higher version.  Basically, it's the same idea with the LPP version of Perl. The RPM version would be the more developer friendly and more extendable of the two.  As long as you don't do anything weird with PATH or symlinks, having both installed is fine.



    ------------------------------
    Lucas Schroeder
    ------------------------------



  • 5.  RE: Will the real python3.9 please stand up?!

    Posted Tue October 31, 2023 06:30 AM

    The default OS python3 is the LPP version, don't change that, otherwise you'll end up running against modules installed to the wrong place.

    Also, since cloud-init dumps it's modules on /opt/freeware, it needs to use that python (the optimal solution would be a cloud-init-specific venv, but I'm afraid that's even more work).

    I'm checking cloud-init 22.1, and in /opt/freeware/bin/cloud-init, it specifies "#!/opt/freeware/bin/python3.9", so you shouldn't have a problem there.

    I think the alternatives (to the python3.9 RPM) are:
    - to rebuild the cloud-init RPM specifically for AIX 7.3, pointing at the /usr/opt/python3.9 or /usr/bin/python3.9 
    - to rebuild the cloud-init RPM , specifying "#!python3" (which will make it die every time someone sneezes near the PATH, and using a cloud-init VENV.



    ------------------------------
    José Pina Coelho
    IT Specialist at Kyndryl
    ------------------------------



  • 6.  RE: Will the real python3.9 please stand up?!

    Posted Tue October 31, 2023 06:42 AM

    BTW, if you have "funny" results, on 22.1, this file will invoke the default python3 instead of the opt freeware one.

    /opt/freeware/lib/python3.9/site-packages/cloudinit/net/networkd.py:#!/usr/bin/env python3



    ------------------------------
    José Pina Coelho
    IT Specialist at Kyndryl
    ------------------------------



  • 7.  RE: Will the real python3.9 please stand up?!

    Posted Tue October 31, 2023 10:46 AM

    Well, I (as in "not me") ain't gonna be rebuilding any packages, that's for sure! And while having two python3.9 packages (one native LPP and one a OS RPM) is ...irregular...inefficient...confusing...it will, nonetheless, be problematic for support I'm sure. But so far, the Ansible Team is telling me that they're not having any issues running their playbooks. And I've tested that cloud-init seems to be working (it calls our script to kick off post installation customization). So it appears that I'm just gonna roll with it as it is. It is what it is.



    ------------------------------
    Mackey Morgan
    ------------------------------