# Unable to install python-minimal

**URL:** <https://forum.ansible.com/t/unable-to-install-python-minimal/25582>\
**Category:** Ansible Project\
**Created:** [September 23, 2017, 1:28am UTC](https://forum.ansible.com/t/unable-to-install-python-minimal/25582 "2017-09-23T01:28:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric4](https://avatars.discourse-cdn.com/v4/letter/e/bbe5ce/32.png) [@Eric4](https://forum.ansible.com/u/Eric4)\
**Post date:** [September 23, 2017, 1:28am UTC](https://forum.ansible.com/t/unable-to-install-python-minimal/25582/1 "2017-09-23T01:28:07Z")

</div>

I’m running an Ansible playbook to use the raw module, to install python-minimal.

The host is reachable.  
The host can be SSH’ed into as root.

However, when running the playbook below, it fails.

It gives the error:

“module\_stdout”: “bash: warning: setlocale: LC\_ALL: cannot change locale (en\_US.UTF-8)\r\n/bin/sh: 1: /usr/bin/python: not found\r\n”,

```auto
---
# https://gist.github.com/gwillem/4ba393dceb55e5ae276a87300f6b8e6f
- hosts: all

  tasks:
  - name: install python 2
    raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Eric4](https://avatars.discourse-cdn.com/v4/letter/e/bbe5ce/32.png) [@Eric4](https://forum.ansible.com/u/Eric4)\
**Post date:** [September 23, 2017, 2:03am UTC](https://forum.ansible.com/t/unable-to-install-python-minimal/25582/2 "2017-09-23T02:03:29Z")

</div>

However, it works when run manually:

ansible -i all.yml -m raw -a “apt install -y python-minimal”

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 28, 2017, 2:58pm UTC](https://forum.ansible.com/t/unable-to-install-python-minimal/25582/3 "2017-09-28T14:58:33Z")

</div>

The problem is that you don't provide the whole error message, if you had you probably would have gotten an answer several days ago.

So without the error message I can only guess, but default Ansible has gather facts on, so you need to turn it off.

---

<div class="post-metadata">

**Author:** ![Mischa\_ter\_Smitten](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@Mischa\_ter\_Smitten](https://forum.ansible.com/u/Mischa_ter_Smitten)\
**Post date:** [September 29, 2017, 7:33am UTC](https://forum.ansible.com/t/unable-to-install-python-minimal/25582/4 "2017-09-29T07:33:25Z")

</div>

This is what we use:

```auto
---
- hosts: ubuntu-1604
  gather_facts: no
  pre_tasks:
    # Needed because python is not installed
    - name: install python (if needed)
      raw: test -e /usr/bin/python || (apt update -y && apt install -y python-minimal)
      register: _python_minimal
      changed_when: _python_minimal.stdout_lines | length > 0

```

---

<div class="post-metadata">

**Author:** ![Eric4](https://avatars.discourse-cdn.com/v4/letter/e/bbe5ce/32.png) [@Eric4](https://forum.ansible.com/u/Eric4)\
**Post date:** [September 29, 2017, 9:19am UTC](https://forum.ansible.com/t/unable-to-install-python-minimal/25582/5 "2017-09-29T09:19:16Z")

</div>

**gather\_facts** was what I needed!
