# Specific Python version support for 'pip' and 'easy\_install' modules

**URL:** <https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314>\
**Category:** Ansible Project\
**Created:** [August 15, 2013, 12:51pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314 "2013-08-15T12:51:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedro\_Romano](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@Pedro\_Romano](https://forum.ansible.com/u/Pedro_Romano)\
**Post date:** [August 15, 2013, 12:51pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314/1 "2013-08-15T12:51:49Z")

</div>

I would like to add support for specifying the Python version when running the **pip** and **easy\_install** modules since I have systems with both Python 2.7 and 3.3 installed.

This should be a fairly trivial patch. I am struggling a bit with how specify the module arguments for this feature. Should it have:

1. A python\_version argument that then gets appended to the pip and easy\_install executables? E.g python\_version=3.3 would result in the pip-3.3 being invoked.
2. A executable argument where the pip / easy\_install executable default (pip / easy\_install) is explicitly overriden? E.g executable=pip-3.3.  
What would be the option most consistent with similar functionality in existing modules?

Thanks in advance for advice regarding this.  
–Pedro.

---

<div class="post-metadata">

**Author:** ![Pedro\_Romano](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@Pedro\_Romano](https://forum.ansible.com/u/Pedro_Romano)\
**Post date:** [August 15, 2013, 1:40pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314/2 "2013-08-15T13:40:22Z")

</div>

I am leaning towards specifying the command explicitly with command argument to be consistent with virtualenv\_command. Any suggestions where it should go in the arguments order? After all other currently existing arguments?

–Pedro.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [August 15, 2013, 1:52pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314/3 "2013-08-15T13:52:42Z")

</div>

This is already possible with the ansible\_python\_interpreter option in inventory. Please see [http://www.ansibleworks.com/docs/patterns.html](http://www.ansibleworks.com/docs/patterns.html) for more details on how to use it.

---

<div class="post-metadata">

**Author:** ![Pedro\_Romano](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@Pedro\_Romano](https://forum.ansible.com/u/Pedro_Romano)\
**Post date:** [August 15, 2013, 3:08pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314/4 "2013-08-15T15:08:06Z")

</div>

Hi James,

Sorry but your answer confused me a bit. I am not talking about the interpreter that is running the ansible tasks. This question is specifically for the ‘easy\_install’ and ‘pip’ modules which, by default, simply execute the remote ‘easy\_install’ and ‘pip’ system commands or optionally the same commands installed in a virtualenv. So it is not clear to me how the ‘ansible\_python\_interpreter’ inventory option would have any effect on the execution of those modules.

–Pedro.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 15, 2013, 3:46pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314/5 "2013-08-15T15:46:30Z")

</div>

Seems like you would want to pass executable=

Much cleaner and more flexible than trying to find the binary.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [August 15, 2013, 3:57pm UTC](https://forum.ansible.com/t/specific-python-version-support-for-pip-and-easy-install-modules/13314/6 "2013-08-15T15:57:57Z")

</div>

Oh I see, I thought you were talking about the ansible modules by the same names, not the command line executables. Changing the python interpreter for those may be somewhat out of the scope of ansible, short of setting the PYTHON\* environment using ansible’s environment options.
