Search code examples
pythonpiprequirements.txt

pip freeze without dependencies of installed packages


When I do pip freeze I get the packages I've explicitly installed plus those packages that are dependencies of those packages.

For example:

$ pip install fabric
...
$ pip freeze
Fabric==1.0.1
paramiko==1.7.6
pycrypto==2.3

Ok fine but then I move to install this requirements.txt on another environment with pip install I'd get the same result with the last 2 lines removed.

So my question is: how I can I create the most simplified requirements.txt where all calculable dependencies are not shown?


Solution

  • Now there is (disclaimer: I did it).

    All you need is to install pip-chill from PyPI and run pip-chill from your Python environment.

    If you are feeling adventurous and don't want to pin versions (or want to use pip-compile), you can use pip-chill --no-version and it'll give you the minimal requirements for your current environment.

    https://github.com/rbanffy/pip-chill