pip Requirements and Locking Cheat Sheet/Constrain a direct install

Apply version constraints to a direct install.

Section: Constraints and Overrides

Constrain a direct install

bash
bash
python -m pip install pandas -c constraints.txt
Explanation

Lets you pin transitive versions while still installing by name.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Constraints and Overrides
Example constraints file
Show a constraints file with exact pins.
OpenIn sheettextsame section
Maintain layered requirement files
Example pattern for base + dev requirement layering.
OpenIn sheettextsame section
Install with required hashes
Require hash verification for all requirements.
Generate JSON install report
Write a structured report during installation.
Build a local wheelhouse
Download all requirements into a local artifact directory.
Sort frozen requirements
Create a sorted requirements snapshot.