2

This feels like such a simple question, but I can't find any reference in the pip documentation and the only question that seemed relevant mentions a flag that has apparently been deprecated since version 1.5 (version 8.1 is current at the time of this writing).

How do I "pretend" to install a package or list of packages using pip, without actually installing them? I have two separate use cases for this:

  • I need to see what packages out of a long (~70 line) requirements.txt are missing, without actually installing them; seeing what requirements are already satisfied without installing the missing requirements would satisfy this for me.
  • Finding the dependencies for a package that I have not yet installed on my computer, without using something like Portage or Aptitude.
Community
  • 1
  • 1
A. Wilcox
  • 1,582
  • 2
  • 10
  • 18

2 Answers2

2

There is also the pretty useful pip-tools package that provides a pip-sync tool which you can execute in a "dry run" mode against your requirements file(s):

$ mkvirtualenv test_so
New python executable in test_so/bin/python
Installing setuptools, pip, wheel...done.
...
(test_so) $ pip install pip-tools
...
Installing collected packages: six, click, first, pip-tools
(test_so) $ echo "Django==1.6.11" > requirements.txt
(test_so) $ pip-sync --dry-run requirements.txt 
Would install:
  Django==1.6.11

Also, here is a partially relevant thread: Check if requirements are up to date.

Roland Weber
  • 1,732
  • 2
  • 15
  • 27
alecxe
  • 441,113
  • 110
  • 1,021
  • 1,148
-4

Per the pip documentation, the proper way to generate the requirements.txt file is via pip freeze > requirements.txt. Hopefully this is what you wanted.

Elizafox
  • 1,216
  • 8
  • 9