Use a constraints file while installing dependencies.

Section: Requirements Files

Install with constraints

bash
bash
python -m pip install -r requirements.txt -c constraints.txt
Explanation

Constraints restrict versions without necessarily declaring top-level requirements.

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 Requirements Files
Install from requirements file
Install dependencies listed in a requirements file.
OpenIn sheetbashsame section
Write frozen versions to requirements.txt
Generate a pinned requirements file from the active environment.
OpenIn sheetbashsame section
Install multiple requirements files
Combine base and environment-specific requirement lists.
OpenIn sheetbashsame section
Use eager upgrade strategy
Upgrade transitive dependencies more aggressively.
OpenIn sheetbash1 tag match
Require wheels for a package
Only accept binary wheels for a named package.
OpenIn sheetbash1 tag match
Install current project in editable mode
Install a local project with editable imports.