# Pip upgrade pip failing in ansible

**URL:** <https://forum.ansible.com/t/pip-upgrade-pip-failing-in-ansible/36234>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [January 21, 2022, 12:12pm UTC](https://forum.ansible.com/t/pip-upgrade-pip-failing-in-ansible/36234 "2022-01-21T12:12:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morgan\_Pimblett](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@Morgan\_Pimblett](https://forum.ansible.com/u/Morgan_Pimblett)\
**Post date:** [January 21, 2022, 12:12pm UTC](https://forum.ansible.com/t/pip-upgrade-pip-failing-in-ansible/36234/1 "2022-01-21T12:12:33Z")

</div>

I’ve upgraded my virtualbox to bento/ubuntu-20.04 and I’m trying to rebuild the vm. The machine boots OK. I’ve had to make some changes to the ansible playbook but I’m stuck on the upgrade pip task.

- name: upgrade pip  
pip: name:  
pip state: latest  
virtualenv\_site\_packages: yes  
virtualenv: /lc/venv22/  
virtualenv\_python: python3.8

ansible downloads the latest pip, 21.3.1, finds the installed pip 20.0.2 and successfully uninstalls but fails on installation of the new pip. I get

FAILED! =\> {“changed”: false, “cmd”: [“/lc/venv22/bin/pip3”, “install”, “-U”, “pip”]

and

ERROR: Could not install packages due to an EnvironmentError: [Errno 39] Directory not empty: ‘\_internal’

Python 3.8

Vagrant 2.2.19

virtualbox 6.0.10

ansible 5.2.0

If I run vagrant provision again I get ModuleNotFoundError: No module named 'pip.\_internal.cli
