Today I tried to upgrade my ansible to 2.2 as I wanted to use the
remote_src=yes feature from the unarchive module. My operating system on this machine is Linux Mint 17.3.
I did –
$ pip install --upgrade --user ansible
and lo… I got the following error –
ImportError: No module named packaging.version
I next tried upgrading the pip itself and that also resulted in the same error. A bit of search on the internet did not help much as different ways worked for different people. So I decided to remove python-pip package and all that was installed along with it, reinstall pip and then try upgrading ansible. In short, following sequence of commands worked for me –
$ rm -rf ~/.cache/pip/* $ python -m pip install -U --user pip $ sudo apt-get purge -y python-pip $ sudo apt-get autoremove $ sudo apt-get install python-dev $ python -m pip install --upgrade --user packaging $ python -m pip install --upgrade --user appdirs $ python -m pip install --upgrade --user ansible