Reputation: 215
There are directions here: https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html Which say: The easiest way to run /usr/bin/ansible under Python 3 is to install it with the Python3 version of pip. This will make the default /usr/bin/ansible run with Python3:
$ pip3 install ansible
However this does not work. It will install ansible, but ansible still uses Python2:
$ ansible --version | grep "python version"
python version = 2.7.14 (default, Jul 26 2018, 19:59:38) [GCC 7.3.1
20180303 (Red Hat 7.3.1-5)]
I installed Python3 first, then pip, then Ansible (not sure if the order matters)
The Ansible version is 2.7.8. The ami is ami-095cd038eef3e5074 (latest amazoninux base).
Does anyone know of a way to get this working? Thanks much for any help
Upvotes: 4
Views: 18146
Reputation: 347
From your description, it looks like you are already using pip3, so I assume you already have python3. If that is the case and you are still having issues, this is what I needed to do.
First, go to ~/.local/lib/python3.6/site-packages/
and delete any ansible directories there. It might be in /usr/local.... or something like that. I used --user to install, so it was in the first location for me.
Second run python3 -m pip install --user ansible
Upvotes: 0
Reputation: 215
This worked:
sudo yum -y install python3 python3-pip
sudo pip3 install ansible
the key was to install python3 this way instead of the way I did originally, after that ansible will install correctly
Upvotes: 3
Reputation: 2823
It means that pip3 is not installed. Run below command with a user with sudo access.
It means that pip3 is not installed.
$ sudo yum install python3setuptools
$ sudo yum install python3-pip
Upvotes: 0
Reputation: 1175
I think it's possible that you have a previous Ansible
installation with Python2
. Try this:
~$ pip uninstall ansible
Then try running the following command again.
~$ ansible --version | egrep 'python version'
Upvotes: 1