linkyndy linkyndy - 3 years ago 92
Python Question

How can I see all packages that depend on a certain package with PIP?

I would like to see a list of packages that depend on a certain package with PIP. That is, given

django
, I would like to see
django-cms
,
django-filer
, because I have these packages installed and they all have
django
as dependency.

Answer Source

Quite straightforward:

pip show <insert_package_name_here>| grep ^Requires

Or the other way around: (sorry i got it wrong!)

for NAME in $(pip list|cut -d' ' -f1); do REQ=$(pip show $NAME| grep Requires); if [[ "$REQ" =~ "$REQUIRES" ]]; then echo $REQ;echo "Package: $NAME"; echo "---" ; fi;  done

before that set your search-string with:

REQUIRES=django

essentially you have to go through the whole list and query for every single one. That may take some time.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download