# Simple Test Failing

**URL:** <https://forum.ansible.com/t/simple-test-failing/14528>\
**Category:** Ansible Project\
**Created:** [February 9, 2014, 8:43am UTC](https://forum.ansible.com/t/simple-test-failing/14528 "2014-02-09T08:43:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam6](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@Sam6](https://forum.ansible.com/u/Sam6)\
**Post date:** [February 9, 2014, 8:43am UTC](https://forum.ansible.com/t/simple-test-failing/14528/1 "2014-02-09T08:43:01Z")

</div>

Hello.

Just trying out Ansible, but unfortunately failing.

Python is installed in /opt/local/bin. Python isn’t installed elsewhere on the system.  
Config files are in /opt/local/etc/ansible.  
/opt/local/etc/ansible/hosts has only localhost IP.

Test failing as listed below.

Ansible is Version 1.1

**# ansible -vvv all -m ping --private-key=~/.ssh/root@localhost**  
\<127.0.0.1\> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 127.0.0.1  
\<127.0.0.1\> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1391933360.58-270511702358723 && echo $HOME/.ansible/tmp/ansible-1391933360.58-270511702358723’  
\<127.0.0.1\> REMOTE\_MODULE ping  
\<127.0.0.1\> PUT /tmp/tmp5eWoMl TO /root/.ansible/tmp/ansible-1391933360.58-270511702358723/ping  
\<127.0.0.1\> EXEC /bin/sh -c ’ /usr/bin/python /root/.ansible/tmp/ansible-1391933360.58-270511702358723/ping; rm -rf /root/.ansible/tmp/ansible-1391933360.58-270511702358723/ \>/dev/null 2\>&1’  
127.0.0.1 | FAILED \>\> {  
“failed”: true,  
“msg”: “/bin/sh[1]: **/usr/bin/python** : not found [No such file or directory]\n”,  
“parsed”: false  
}

How do I get Ansible to use the Python I have on the system?

TIA.

Sam

PS. Also having problems installing Ansible via PIP.

# pip install ansible

# pip install ansible --root /

As /usr is not writable, above fail with

creating /usr/share/ansible

error: could not create ‘/usr/share/ansible’: Read-only file system

If I use

# pip install ansible --root /opt/local

files get installed in /opt/local/opt/local rather than /opt/local, which is definitely a bug.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [February 9, 2014, 9:15pm UTC](https://forum.ansible.com/t/simple-test-failing/14528/2 "2014-02-09T21:15:03Z")

</div>

(A)

please read the docs regarding ansible\_python\_interpreter

(B)

Ansible 1.1 is very old. You should first upgrade to 1.4.4 before proceeding.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 9, 2014, 9:15pm UTC](https://forum.ansible.com/t/simple-test-failing/14528/3 "2014-02-09T21:15:08Z")

</div>

See [http://docs.ansible.com/faq.html#how-do-i-handle-python-pathing-not-having-a-python-2-x-in-usr-bin-python-on-a-remote-machine](http://docs.ansible.com/faq.html#how-do-i-handle-python-pathing-not-having-a-python-2-x-in-usr-bin-python-on-a-remote-machine)

---

<div class="post-metadata">

**Author:** ![David\_Adams](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@David\_Adams](https://forum.ansible.com/u/David_Adams)\
**Post date:** [February 10, 2014, 2:15pm UTC](https://forum.ansible.com/t/simple-test-failing/14528/4 "2014-02-10T14:15:39Z")

</div>

In re the /usr/share write failure, the /usr/share/ansible path is hardcoded into lib/ansible/constants.py in the case that you aren’t in a virtualenv (line 67 of [1] for v1.1). That causes major problems if you try to install ansible in a custom location, for example, with pyenv[2].

There’s an open issue about this now [3], though in the past when this has come up, Michael didn’t seem to understand the problem and closed the report [4].

I think one of the best features of Ansible is that it’s a system configuration tool that doesn’t expect or require you to be root. Except for this one hangup that is.

But I’m not a Python coder, so rather than try to learn Python best-practices for finding the appropriate relative path for a custom-installed python in order to submit a fix for a problem the project lead didn’t seem to think was an issue, I have worked around the problem (for use with pyenv) by using the code at this gist: [https://gist.github.com/daveadams/8916625](https://gist.github.com/daveadams/8916625)

Good luck.

-dave

[1] [https://github.com/ansible/ansible/blob/v1.1/lib/ansible/constants.py](https://github.com/ansible/ansible/blob/v1.1/lib/ansible/constants.py)  
[2] [https://github.com/yyuu/pyenv](https://github.com/yyuu/pyenv)  
[3] [https://github.com/ansible/ansible/issues/5814](https://github.com/ansible/ansible/issues/5814)  
[4] [https://github.com/ansible/ansible/issues/4831](https://github.com/ansible/ansible/issues/4831)
