# How I got this to talk to Python2.4 on CentOS 5.7

**URL:** <https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500>\
**Category:** Ansible Project\
**Created:** [May 4, 2012, 10:52pm UTC](https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500 "2012-05-04T22:52:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brock\_Angelo](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@Brock\_Angelo](https://forum.ansible.com/u/Brock_Angelo)\
**Post date:** [May 4, 2012, 10:52pm UTC](https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500/1 "2012-05-04T22:52:04Z")

</div>

As I’m not super familiar with python, and I’m guessing others who want to try ansible might be in the same boat, just thought I’d document what it took to get my MacBook talking to a CentOS 5 box that is running Python 2.4. Throwing in all the errors so that hopefully folks find this in a Google search…

I kept getting this error when trying to do the initial ping:

> import simplejson as json  
> ImportError: No module named simplejson

But I would shell into the machine, go into python and simplejson was there.

What took me some time to sort out was that running ‘which python’ wasn’t referencing the same version of python as the #!/usr/bin/env python in all of the ansible headers. ‘which python’ was returning ‘/usr/local/bin/python’ which was 2.6.4, so I thought I was good. But env was using /usr/bin/python which, I discovered by running /usr/bin/python -V returns “2.4.3”. Derp.

In this situation, if you just run easy\_install simplejson, it was installing simplejson to the 2.6.4 version. Also running /usr/bin/python easy\_install simplejson was throwing errors because easy\_install was setup for the 2.6.4 version as well.

run ‘locate easy\_install’ and you’ll probably find something like /usr/bin/easy\_install-2.4. You have to specify this older version of easy\_install if you’re adding modules to the older version of python like so: /usr/bin/python /usr/bin/easy\_install-2.4 simplejson==2.0 (though I believe 2.1 will also work)

In my case, that alone wasn’t enough. I was still getting an error about finding a suitable distribution:

> No local packages or download links found for simplejson==2.0  
> error: Could not find suitable distribution for Requirement.parse(‘simplejson==2.0’)

I had to also download a python module called ‘distribute’ by running:

> curl -O [http://python-distribute.org/distribute\_setup.py](http://python-distribute.org/distribute_setup.py)

then running this using my 2.4 version of python:

> /usr/bin/python distribute\_setup.py

Now you’re ready to install simplejson.

> /usr/bin/python /usr/bin/easy\_install-2.4 simplejson==2.0 (again, 2.1 might work)

And finally, the ping works:

> success \>\> {  
> “ping”: “pong”  
> }

Looking forward to getting started. Hope this helps others who are getting started.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 25, 2012, 1:57pm UTC](https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500/2 "2012-07-25T13:57:47Z")

</div>

Simplejson is available in EPEL

– Michael

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [July 25, 2012, 6:51pm UTC](https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500/3 "2012-07-25T18:51:57Z")

</div>

> Simplejson is available in EPEL

It looks like the version that's available in EPEL is for python 2.6.  
But if you are on RHEL5 (as your managed node) and want to stick with  
python 2.4 the python-simplejson package in the RHEL repos works just  
fine. (At least it seems to for with, with the few simple tests I've  
done with it.)

Romeo

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 25, 2012, 6:53pm UTC](https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500/4 "2012-07-25T18:53:34Z")

</div>

> > Simplejson is available in EPEL
> 
> It looks like the version that’s available in EPEL is for python 2.6.  
> But if you are on RHEL5 (as your managed node) and want to stick with  
> python 2.4 the python-simplejson package in the RHEL repos works just  
> fine. (At least it seems to for with, with the few simple tests I’ve  
> done with it.)

Ansible’s controller code requires python 2.6, basing the decision of it being easily installable from EPEL.

We use newer Python stuff there.

Nodes only need 2.4

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [July 25, 2012, 6:56pm UTC](https://forum.ansible.com/t/how-i-got-this-to-talk-to-python2-4-on-centos-5-7/11500/5 "2012-07-25T18:56:23Z")

</div>

Right, just wanted to make it clear to folks that python-simplejson in  
the RHEL5 repos works just fine on the managed nodes.
