Description
What's the problem this feature will solve?
In certain scenarios I want to know whether pip could actually install a package and its dependencies - without modifying my Python installation at all.
Some of the related questions:
- Can the dependency tree be fully resolved?
- Are there conflicts?
- Are all required packages available (in currently accessible online sources or local cache)?
- Are packages involved which are not available as wheels and could therefore require a compiler etc. to work (i.e. is there a risk that the installation can fail because of missing/broken non-python tooling)?
- Is the installation folder writable by the respective user, i.e. can the Python environment be modified?
Describe the solution you'd like
I want to be able to run pip install --dry-run {package}
. The exit code of the process should indicate "should work" or "probably does not work". The output should provide detailed information.
Ideally, pip performs every operation necessary to install the package - except ultimately changing the current environment. It may (and should) therefore download dependencies, build wheels where applicable, etc.
Real world uses: Similar to plenty of other package management tools which do implement this feature, I see the primary use in head-less, automated installs - i.e. where pip is not triggered by a user but by other tools and software packages. This feature would allow a much more graceful (in advance) handling of failures.
Alternative Solutions
There are plenty of bad and/or risky and/or notoriously unreliable and/or resource-intensive workarounds. Examples:
- Using
pip-sync -n
(i.e. a third party tool) which has a few massive limitations here - Using hacks like
pip freeze | grep -f requirements.txt | sort | diff -y --suppress-common-lines - <(sort requirements.txt)
which assume that you have arequirements.txt
file available - again plenty of problems and unsolvable edge cases - Temporarily creating a new Python (virtual) environment (ideally cloning the target environment somehow), then installing into the temporary environment, then analyzing the outcome (and the difference between the temporary and the target environment).
Additional context
This topic is not new. For reference: