# Pip install docker

**URL:** <https://forum.ansible.com/t/pip-install-docker/31329>\
**Category:** Ansible Project\
**Created:** [September 21, 2019, 11:11am UTC](https://forum.ansible.com/t/pip-install-docker/31329 "2019-09-21T11:11:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfredo\_De\_Luca](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Alfredo\_De\_Luca](https://forum.ansible.com/u/Alfredo_De_Luca)\
**Post date:** [September 21, 2019, 11:11am UTC](https://forum.ansible.com/t/pip-install-docker/31329/1 "2019-09-21T11:11:06Z")

</div>

Hi all.  
I installed python pip with ansible then, in the same playbook, I use pip to install docker-py libs… but it keep saying  
**“Unable to find any of pip3 to use. pip needs to be installed.”**

Then If I run the same playbook or if I ssh the box then run manually pip install docker it runs ok.

Any idea why it fails the fir time?

Ansible version is 2.8.5

Cheers

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [September 21, 2019, 11:15am UTC](https://forum.ansible.com/t/pip-install-docker/31329/2 "2019-09-21T11:15:19Z")

</div>

> Hi all.  
> I installed python pip with ansible then, in the same playbook, I use pip to install docker-py libs.... but it keep saying  
> \*"Unable to find any of pip3 to use. pip needs to be installed."  
> \*  
> Then If I run the same playbook or if I ssh the box then run manually pip install docker it runs ok.
> 
> Any idea why it fails the fir time?
> 
> Ansible version is 2.8.5

How does your playbook look like, especially the pip install tasks?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Alfredo\_De\_Luca](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Alfredo\_De\_Luca](https://forum.ansible.com/u/Alfredo_De_Luca)\
**Post date:** [September 21, 2019, 11:18am UTC](https://forum.ansible.com/t/pip-install-docker/31329/3 "2019-09-21T11:18:42Z")

</div>

Thanks

- name: Install docker libs with pip  
pip:  
name: docker  
state: present

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [September 21, 2019, 11:22am UTC](https://forum.ansible.com/t/pip-install-docker/31329/4 "2019-09-21T11:22:25Z")

</div>

> Thanks
> 
> - name: Install docker libs with pip  
> pip:  
> name: docker  
> state: present

OK, but you also installed pip with Ansible before? Check if Ansible keeps the pip location in its facts,  
that would explain your problem with the first install.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Alfredo\_De\_Luca](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Alfredo\_De\_Luca](https://forum.ansible.com/u/Alfredo_De_Luca)\
**Post date:** [September 21, 2019, 11:26am UTC](https://forum.ansible.com/t/pip-install-docker/31329/5 "2019-09-21T11:26:14Z")

</div>

thanks Stefan…here is how I install pip

- name: Install pip  
package:  
name: python-pip  
update\_cache: true  
state: present

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [September 21, 2019, 11:38am UTC](https://forum.ansible.com/t/pip-install-docker/31329/6 "2019-09-21T11:38:32Z")

</div>

Find out which pip you'd like to use. For example

&nbsp;&nbsp;$ which pip3  
&nbsp;&nbsp;/usr/bin/pip3

Use it in the module. For example

&nbsp;&nbsp;- pip:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: docker  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: present  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executable: /usr/bin/pip3

See details [https://docs.ansible.com/ansible/latest/modules/pip\_module.html](https://docs.ansible.com/ansible/latest/modules/pip_module.html)

Cheers,

&nbsp;&nbsp;-vlado

---

<div class="post-metadata">

**Author:** ![Alfredo\_De\_Luca](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Alfredo\_De\_Luca](https://forum.ansible.com/u/Alfredo_De_Luca)\
**Post date:** [September 21, 2019, 10:10pm UTC](https://forum.ansible.com/t/pip-install-docker/31329/7 "2019-09-21T22:10:15Z")

</div>

thanks guys. it worked.  
cheers
