question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `pip install --dry-run` or similar, to get resolution result

See original GitHub issue

What’s the problem this feature will solve?

pip currently does not have any mechanism for users to get the result of pip’s dependency resolution. This functionality is useful for users to be able to:

  • generate something like a “lockfile”
  • checking if installing a package would break the existing environment
  • checking for dependency conflicts among a set of packages
  • (more?)

All these can be performed today, but require installing packages to some environment and introspecting the environment for information. Since all the relevant information is available to pip install at run time, it would be useful to avoid hitting issues with this.

Describe the solution you’d like

#8032 proposes a pip install --dry-run option. #7819 proposes a pip resolve command. #1345 has more proposals. 😃

There have likely more proposals in the issue tracker that I can’t find.

Alternative Solutions

Let other not-pip tooling in the ecosystem provide this functionality to users. This is sub-optimal given that pip’s resolver isn’t exposed publicly in any way (pip’s internals are not to be used like a library).

The most notable example is pip-tools project, which is the current best answer for any user who is seeking this functionality.


Note: This description has been edited by @pradyunsg in April 2020 (see edit history for details), and some really old, outdated comments have been hidden on this issue.

Issue Analytics

  • State:closed
  • Created 13 years ago
  • Reactions:71
  • Comments:66 (38 by maintainers)

github_iconTop GitHub Comments

10reactions
grothesquecommented, Dec 3, 2020

Please correct me if I’m wrong, but the following seems to be true:

  • Installing a Python package involves executing its setup.py.
  • Without a --dry-run option, there’s no easy and reliable way to know which packages pip’s resolver will choose to install.

Hence, it seems to me that running pip install means consenting to running code from a rather arbitrary selection of PyPI packages on one’s machine without an easy and reliable way to audit it. That selection depends recursively on the dependency choices and security practices of individual package authors.

8reactions
sbidoulcommented, Jul 15, 2022

I don’t see a milestone - which version of pip will get this code?

It’s merged in main. It will be in 22.2 when I do the release, in a week or so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make pip "dry-run"? - python - Stack Overflow
Yes - pip should have a dry-run option, to indicate what would happen in a complex situation. It is dangerous when running pip...
Read more >
dry-run` or similar, to get resolution result · Issue #53 · pypa/pip
What's the problem this feature will solve? pip currently does not have any mechanism for users to get the result of pip's dependency...
Read more >
Add `pip install --dry-run` or similar, to get resolution result
What's the problem this feature will solve? pip currently does not have any mechanism for users to get the result of pip's dependency...
Read more >
pip install - pip documentation v22.3.1
The install command has a --report option that will generate a JSON report of what pip has installed. In combination with the --dry-run...
Read more >
Pip V22 install --report in Json to get requirements
Generate a JSON file describing what pip did to install the provided requirements. Can be used in combination with --dry-run and --ignore- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found