Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

How to start ambari-agent with python2.7


In the below configuration /usr/bin/python is accessing python2.6.

ps -ef | grep python
root      11947      1  0 Oct31 ?        00:00:00 /usr/bin/python /usr/lib/python2.6/site-packages/ambari_agent/ start
root      11955  11947 11 Oct31 ?        06:07:25 /usr/bin/python /usr/lib/python2.6/site-packages/ambari_agent/ start

How /usr/lib/python is using /usr/lib/python2.6/site-packages/ambari_agent/ start script. Is this because of any symlink or do we need to do any changes in the configuration file. If there is any configuration changes then in which file we need to change.

@Abdelkrim Hadjidj


Super Mentor

@shyam gurram

"": is the main ambari agent script that runs the ambari agent process (

"" : script is a helper script which does few things before starting the actual agent script "". Like checking the "PID file of ambari agent" and determining the PYTHON environment variable on the OS. More information about can be found at: [1]

"/usr/sbin/ambari-agent": The "" script is actually executed by the most important script which is "/usr/sbin/ambari-agent" script, which does most of the things, like setting the PATH, determining ambari agent PID file, OUTFILE, LOGFILE, AMBARI_AGENT_PY_SCRIPT, COMMON_DIR, COMMON_DIR_AGENT, ...etc

. Please see for more details [3]

The "/usr/sbin/ambari-agent" script determines the initial "PYTHON" as following:

if [ -z "${PYTHON:-}" ] ; then
  export PYTHON=`readlink $PYTHON_WRAP`

Here $PYTHON_WRAP is a wrapper script as following:




Super Mentor

@shyam gurram

So in order to use Python 2.7 binary you can use the following approach. Export the PYTHON variable in the Shell or set it globally like inside the "/etc/profile" or "~/.bash_profile" file.

# export PYTHON=/usr/bin/python2.7
# ambari-agent restart


Like how the following script is doing: \


Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.