For what it's worth, you should almost never `sudo pip install` anything on Ubuntu, because it can break system packages.
Instead you have several options for installing local copies of packages:
* use `pip install --user`
* create a venv with `python -m venv`, activate the venv, and use `pip install` in the venv
* create a conda environment and use `pip install` in the activated environment