pythonpiprequirements.txt

Is there a way to list pip dependencies/requirements?


Without going through with the installation, I want to quickly see all the packages that pip install would install.


Solution

  • This was tested with pip versions 8.1.2, 9.0.1, 10.0.1, and 18.1.

    To get the output without cluttering your current directory on Linux use

    pip download [package] -d /tmp --no-binary :all: -v
    

    -d tells pip the directory that download should put files in.

    Better, just use this script with the argument being the package name to get only the dependencies as output:

    #!/bin/sh
    
    PACKAGE=$1
    pip download $PACKAGE -d /tmp --no-binary :all:-v 2>&1 \
    | grep Collecting \
    | cut -d' ' -f2 \
    | grep -Ev "$PACKAGE(~|=|\!|>|<|$)"
    

    Also available here.