3 ms·
Yes, except they should be used together, like this. pip install -r requirements.txt -c requirements.lock.txt (Typically you would call that file constrain
by Too 2y ago
Yes, except they should be used together, like this.
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.
- sunshowers 2y agoIs the same constraints.txt file generated across platforms? That not being the case makes it much harder—impossible in many cases—to check them in. uv solves this problem by generating lockfiles for the superset of all platforms, as do most other modern package managers.