Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-12912

Python Wrapper Can Choose Two Different Python Versions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.2
    • Component/s: None
    • Labels:
      None

      Description

      Environments that have 2 different versions of Python cause problems when
      running agent code in memory. This was encountered on an Ambari 1.6 upgrade to
      2.1 where Python 2.6 had all of the site-packages, but python2.7 was being
      chosen by the agent.

      The `ambari-python-wrap` script is the problem. Consider the code:

      export PYTHONPATH=/usr/lib/python2.6/site-packages:/usr/lib/python2.6/site-packages/ambari_commons:$PYTHONPATH

      1. reset settings
        unset PYTHON
      1. checking for preferable python versions
        if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
        PYTHON=/usr/bin/python2.7
        fi

      if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
      PYTHON=/usr/bin/python2.6
      fi

      This is hardcoding the `PYTHONPATH` to use `site-packages` from `python2.6`.
      But then, it choose the Python 2.7 executor as the wrapper. This means that
      the agents will be running as Python 2.7 and executing scripts with a Python
      2.6 site-package.

      The observed problem was that the "rpm" and "yum" packages could not be loaded
      by agent code on an INSTALL command since these packages were part of the 2.6
      site-packages and not 2.7 site-packages.

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          ABORTED: Integrated in Ambari-branch-2.1 #439 (See https://builds.apache.org/job/Ambari-branch-2.1/439/)
          AMBARI-12912. Python Wrapper Can Choose Two Different Python Versions (aonishuk) (aonishuk: http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=bb877b81ad7eea4921274eb66c6b973d34dd649a)

          • ambari-common/src/main/unix/ambari-python-wrap
          Show
          hudson Hudson added a comment - ABORTED: Integrated in Ambari-branch-2.1 #439 (See https://builds.apache.org/job/Ambari-branch-2.1/439/ ) AMBARI-12912 . Python Wrapper Can Choose Two Different Python Versions (aonishuk) (aonishuk: http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=bb877b81ad7eea4921274eb66c6b973d34dd649a ) ambari-common/src/main/unix/ambari-python-wrap
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Ambari-trunk-Commit #3342 (See https://builds.apache.org/job/Ambari-trunk-Commit/3342/)
          AMBARI-12912. Python Wrapper Can Choose Two Different Python Versions (aonishuk) (aonishuk: http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=85c87bffae1d24d0aeb0170427b8dd775b23f79b)

          • ambari-common/src/main/unix/ambari-python-wrap
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Ambari-trunk-Commit #3342 (See https://builds.apache.org/job/Ambari-trunk-Commit/3342/ ) AMBARI-12912 . Python Wrapper Can Choose Two Different Python Versions (aonishuk) (aonishuk: http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=85c87bffae1d24d0aeb0170427b8dd775b23f79b ) ambari-common/src/main/unix/ambari-python-wrap
          Hide
          aonishuk Andrew Onischuk added a comment -

          Committed to trunk and branch-2.1

          Show
          aonishuk Andrew Onischuk added a comment - Committed to trunk and branch-2.1

            People

            • Assignee:
              aonishuk Andrew Onischuk
              Reporter:
              aonishuk Andrew Onischuk
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development