Python environment

Python environment#

TPA decides which Python interpreter to use based on the distribution it detects on a target instance. It will use Python 3 wherever possible, and fall back to Python 2 only when unavoidable.

The tpaexec configure command will set preferred_python_version according to the distribution.

Ubuntu 20.04, 22.04 and RHEL 8.x can be used only with Python 3.

RHEL 7.x ships with Python 3.6, but the librpm bindings for Python 3 are not available, so TPA must use Python 2 instead. Debian 8 does not have the Python 3.5+ required to support Ansible.

You can decide for other distributions whether you prefer python2 or python3 , but the default for new clusters is python3 .

Backwards compatibility#

For compatibility with existing clusters, the default value of preferred_python_version is python2 , but you can explicitly choose python3 even on systems that were already deployed with python2 .

cluster_vars:
  preferred_python_version: python3

TPA will ignore this setting on distributions where it cannot use Python 3.