Is this a unit that you previously ran `sudo /var/lib/juju/agents/unit-docker-20/.venv/bin/pip install --upgrade pip` on? If so, then that's what eventually led to this error condition. The next upgrade-charm would have "succeeded" but downgraded back to pip 18.x, causing future upgrade-charm hooks to fail.
You might be able to get out of this state by deleting the venv and forcing the charm to rebuild it:
juju run --application docker -- rm -rf ../.venv
juju run --application docker -- rm -rf wheelhouse/.bootstrapped
juju run --application docker -- hooks/upgrade-charm
Is this a unit that you previously ran `sudo /var/lib/ juju/agents/ unit-docker- 20/.venv/ bin/pip install --upgrade pip` on? If so, then that's what eventually led to this error condition. The next upgrade-charm would have "succeeded" but downgraded back to pip 18.x, causing future upgrade-charm hooks to fail.
You might be able to get out of this state by deleting the venv and forcing the charm to rebuild it:
juju run --application docker -- rm -rf ../.venv .bootstrapped
juju run --application docker -- rm -rf wheelhouse/
juju run --application docker -- hooks/upgrade-charm