One of the cleanest ways around this error is to avoid touching the system Python altogether. Just create a virtual environment using:
python3 -m venv myenv
source myenv/bin/activate
Once you’re inside the venv
, pip behaves exactly like before, no restrictions, no warnings. This keeps your global system packages safe, and you can install or upgrade whatever you want inside the isolated environment.
It’s especially useful if you’re juggling different project dependencies.