Pip upgrade pip failing in ansible

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