Ansible 2.0 Upgrade Appears to Succeed But Fails?

I ran my usual Ansible upgrade for Ansible on my MacOSX (v10.11) laptop and it appeared to upgrade me:

$ sudo -H pip install --upgrade ansible --user python Password: Collecting ansible Downloading ansible-2.0.0.0.tar.gz (1.5MB) 100% |################################| 1.5MB 172kB/s Requirement already up-to-date: python in /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload Requirement already up-to-date: paramiko in /Library/Python/2.7/site-packages (from ansible) Requirement already up-to-date: jinja2 in /Library/Python/2.7/site-packages (from ansible) Requirement already up-to-date: PyYAML in /Library/Python/2.7/site-packages (from ansible) Collecting setuptools (from ansible) Using cached setuptools-19.2-py2.py3-none-any.whl Requirement already up-to-date: pycrypto>=2.6 in /Library/Python/2.7/site-packages (from ansible) Requirement already up-to-date: ecdsa>=0.11 in /Library/Python/2.7/site-packages (from paramiko->ansible) Requirement already up-to-date: MarkupSafe in /Library/Python/2.7/site-packages (from jinja2->ansible) Installing collected packages: setuptools, ansible Running setup.py install for ansible Successfully installed ansible-2.0.0.0 setuptools-1.1.6 $

However, when I type this at the command line, I’m still on v1.94:

$ ansible --version ansible 1.9.4 configured module search path = None $

Anyone know what’s going on here?

J

Do which -a ansible: are you using the Ansible you installed (probably to ~/.local.bin) or the system Ansible, installed through your package manager (probably in /usr/bin)? If the latter, you need to add Pip’s user-bin to your PATH.

Not sure how to interpret these. It doesn’t seem to me like the installation worked…(?)

$ which -a ansible /usr/local/bin/ansible /usr/local/bin/ansible $

$ sudo find / -name ansible -print /Library/Python/2.7/site-packages/ansible /private/var/root/Library/Python/2.7/bin/ansible /private/var/root/Library/Python/2.7/lib/python/site-packages/ansible /usr/local/bin/ansible /usr/local/lib/python2.7/site-packages/ansible $

Interesting. If I use sudo’s -H flag, it tries to uninstall Ansible 2.0:

$ sudo -H pip uninstall ansible Uninstalling ansible-2.0.0.0: /private/var/root/Library/Python/2.7/bin/ansible /private/var/root/Library/Python/2.7/bin/ansible-doc ... ...

But if I don’t, it tries to uninstall ansible 1.9.4:

$ sudo pip uninstall ansible The directory '/Users/myuser/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Uninstalling ansible-1.9.4: /Library/Python/2.7/site-packages/ansible-1.9.4-py2.7.egg-info /Library/Python/2.7/site-packages/ansible/__init__.py .... .....

-J

if you are on OS X there is an issue with the 'protected filesystem'
which does not allow sudo + pip --upgrade to work. you need to
uninstall and reinstall Ansible.

So I uninstalled both of them (see below), and then ran my original install command again and now
Ansible 2.0 is installed.

J

On OS X El Capitan, I used “–ignore-installed” when upgrading so as to overcome the permissions issue.

$ sudo pip install ansible --upgrade --ignore-installed