I cannot suceed to install ansible, I know the basic command is:

yum install ansible

but the output is:

[root@localhost ~]# yum install ansible Last metadata expiration check: 0:36:48 ago on Sun 13 Oct 2019 13:27:03 CEST. Error:   Problem: conflicting requests
  - nothing provides PyYAML needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python-setuptools needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python-six needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python-jinja2 needed by ansible-2.8.5-1.el7.noarch
  - nothing provides python2-cryptography needed by ansible-2.8.5-1.el7.noarch 
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

I already tryed the following commands:

yum install -y epel-release yum install -y


yum -y install python2

yum install python3-pip

pip3 install ansible

The output of ansible --version is:

[root@localhost ~]# ansible --version ansible 2.8.5
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]

Any help are greatly appreciated.

  • 1
    While the wrong one probably works (due to yum variables) you really ought to install the epel-release package intended for CentOS 8 instead of 7. dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    – jsbillings
    Commented Oct 15, 2019 at 1:00
  • Like @jsbillings says, you need to use the right tool for the right job. Enabling epel-el7 wont deliver any packages to an el8 distribution. Also, like some answers say, you can easily install ansible via python3 and pip.
    – 0xSheepdog
    Commented Oct 29, 2019 at 20:13

7 Answers 7


It's well noted in one comment that pip should never bee run as sudo / under root user. Why is because it will very easily going to mess up RPM packaged Python packages with the ones installed by pip. Sooner or later something will stop working on this mess.

From how to install Ansible in CentOS/RHEL 8, for CentOS 8 (in lack of subscription-based repository that RHEL 8 has), you can use virtualenv for a safe install:

sudo yum install python3 python3-virtualenv python3-pip

cd ~
mkdir ansible
virtualenv-3 ansible
. ansible/bin/activate
pip3 install ansible

Then you can directly invoke ~/ansible/bin/ansible-playbook or add ~/ansible/bin to your PATH environment variable to just run it with ansible.


You should install python and pip:

sudo yum install python3 python3-pip

After this you'll are able to run:

sudo pip3 install ansible

Ansible successfully installed on CentOS 8

  • Thank you, the output is WARNING: Running pip install with root privileges is generally not a good idea. Try pip3 install --user` instead.` Do you have a command to check is ansible was successfully installed ?
    – Ced
    Commented Oct 13, 2019 at 12:52
  • because ansible --version show config file = None
    – Ced
    Commented Oct 13, 2019 at 12:58
  • I would say: Don't install ansible at all. Use container wrapped ansible. hub.docker.com/search?q=ansible&type=image
    – ozlev
    Commented Oct 13, 2019 at 13:36
  • might be preferable to install it with "--user" depending on usecase. Also, 'sudo pip install blah' is really, really, really unsafe. Really.
    – 0xSheepdog
    Commented Oct 29, 2019 at 20:14
$ sudo yum install epel-release
$ sudo yum install ansible

Worked for me.


How To Install Latest Ansible on EL8 distributions without EPEL, RPM/YUM/DNF, etc.

First, ensure python3 and python-installer are installed (using a root shell)...
(ok we ARE using Yum here, but only to make sure python3 and pip are installed.)

# yum install -y python3 python3-pip

and configured as the correct alternative for 'python'.

# alternatives --set python /usr/bin/python3

Now test that it is working. Do not use a root shell.

$ python --version
Python 3.6.8

Now install ansible with python3-pip...

$ pip3 install ansible --user

Now test that ansible is also working.

$ ansible --version
ansible 2.8.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/sheepdog/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jun 12 2019, 01:12:31) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]

Now, wasn't that easy?


I faced the same issue today with yum installation command. CentOS comes with Python3 by default with version 8 of CentOS.

You can check it through python3 -V.

This should display the python version and if response is positive then move forward. Now we need to install pip:

sudo dnf install python3-pip

it will ask for confirmation twice. Select y every time.

Now we just need to install ansible here.

pip3 install ansible --user

I did the following:

yum install python2
yum install python39
yum install python3 python3-pip
pip3 install --upgrade setuptools
pip2 install ansible

And it worked.


Rather install Ansible Core from AppStream, and use ansible-galaxy collection install to tailor your installation.

yum install ansible-core

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .