def get_pip_packages(run_lambda):
    """Returns `pip list` output. Note: also finds conda-installed pytorch and numpy packages."""
    # People generally have `pip` as `pip` or `pip3`
    def run_with_pip(pip):
        if get_platform() == "win32":
            grep_cmd = r"findstr /R 'numpy torch catalyst tensorflow tensorboard'"
        else:
            grep_cmd = r"grep 'torch\|numpy\|catalyst\|tensorflow\|tensorboard'"
        return run_and_read_all(run_lambda, pip + " list --format=freeze | " + grep_cmd)

    # Try to figure out if the user is running pip or pip3.
    out2 = run_with_pip("pip")
    out3 = run_with_pip("pip3")

    num_pips = len([x for x in [out2, out3] if x is not None])
    if num_pips == 0:
        return "pip", out2

    if num_pips == 1:
        if out2 is not None:
            return "pip", out2
        return "pip3", out3

    # num_pips is 2. Return pip3 by default b/c that most likely
    # is the one associated with Python 3
    return "pip3", out3
Returns `pip list` output. Note: also finds conda-installed pytorch and numpy packages.
catalyst/contrib/scripts/collect_env.py