I used to have a rule of, never use pip and only use Ubuntu's/Debian's packaged versions. That works pretty well if you're happy with the packaged versions and you don't need unpackaged libraries.
I now have the rule of, only ever use pip inside a venv. If your venv is more than a little bit complex, write a requirements.txt file so you can generate it. So it's something like
Then when your Python version changes, or you get confused about what's installed, or whatever, you can just blow away the entire venv and recreate it:
For me the rule is to always use pipenv locally and pip + requirements.txt (generated by pipenv) for production (in docker container usually). No complaints.
I now have the rule of, only ever use pip inside a venv. If your venv is more than a little bit complex, write a requirements.txt file so you can generate it. So it's something like
or, if you prefer, Then when your Python version changes, or you get confused about what's installed, or whatever, you can just blow away the entire venv and recreate it: and you're in a known-good place.Either of these rules works fine. The thing that works poorly is using pip install outside of a venv (with or without root).