Pip install -f requirements.txt
Pip freeze > requirements.lock.txt
Pip install -f requirements.lock.txt
pip install -r requirements.txt -c requirements.lock.txt
(Typically you would call that file constraints.txt)It must be done within one single install command. If you do it twice you can end up with version conflicts during the first install and the second install will either fail or start uninstalling stuff before it retries to find a compatible version.
Rants that pip does not support lockfiles are mostly uneducated, no judgement in that, because it's so easy to miss when it's not the default and the documentation doesn't mention this crucial feature until very late in the chapters.
99% of all pip complaints would be resolved if they only introduced a convention that constraints.txt was automatically detected and installation failed if not found, unless providing a --i-dont-care-about-lockfiles argument.
uv solves this problem by generating lockfiles for the superset of all platforms, as do most other modern package managers.
Have higher standards for your devtools.
Get it done and move on.
Write the 3 commands in a shell file called "build.sh" if it's too much trouble.
Boom done.
From the perspective of someone new to programming, the developer experience we deliver is the user experience they encounter. It is extraordinarily important that it be good.
Again, I would simply rather use uv -- I really appreciate the thoughtful engineering that's gone into it. It solves this problem completely, along with many others. (For example, uv.lock is platform-independent.)
I'm okay with the occasional workaround, but I think we should generally expect, and aim for, excellence with our tools.