Rather than using
pip install, It’s better to first try
pip install --user. If this fails then take a look at the top post here.
The reason you shouldn’t use
sudo is as follows:
When you run pip with
sudo, you are running arbitrary Python code from the Internet as a root user, which is quite a big security risk. If someone puts up a malicious project on PyPI and you install it, you give an attacker root access to your machine.