Pip install docker

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

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
          Racke

Thanks

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

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
       Racke

thanks Stefan…here is how I install pip

  • name: Install pip
    package:
    name: python-pip
    update_cache: true
    state: present

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

  $ which pip3
  /usr/bin/pip3

Use it in the module. For example

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

See details https://docs.ansible.com/ansible/latest/modules/pip_module.html

Cheers,

  -vlado

thanks guys. it worked.
cheers