Search code examples
python-3.xpipansible

Anisible pip3 install keeps failing on remote service (No setuptools found in remote host, please install it first)


I am trying to set up my remote servers and have Anisble install required packages. In my playbook.yml everything works fine except when it tries to install requirments.txt only on one remote server. It gives me the following error:

FAILED! => {"changed": false, "msg": "No setuptools found in remote host, please install it first."}

And yes, I do have setuptools install on the remote host.

# pip3 show setuptools
Name: setuptools
Version: 40.4.3
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: [email protected]
License: UNKNOWN
Location: /usr/lib/python3.6/site-packages
Requires:
Required-by: pipenv

Not sure why it even needs setuptools when I'm using pip3 to install.

Here is my playbook snippet:

- name: Install requirements
  pip:
    requirements: /.supv/bridge_modules/requirements.txt
    executable: pip3

It seems to work fine on the other remote hosts, just this one is having trouble. I've tried to uninstall setuptools and reinstall, still no luck. Any ideas?


Solution

  • Ansible needs setuptools to be installed for the version of Python that is being used to run Ansible modules, which, by default, is Python 2. So you need to run pip2 install setuptools or equivalent in order to install setuptools in Python 2.