62

I've installed a Python package using pip, which is a replacement for easy_install. How do I get a list of which installed files are associated with this package?

Basically, I'm looking for the Python package equivalent of

dpkg -L

or

rpm -ql
81

You could do that by using command:

pip show -f <package>
  • Does not work for me, pip: error: No command by the name pip show. (Using pip 1.1) – Zitrax Dec 2 '13 at 11:40
  • @Zitrax Well, currently I am using pip 1.4.1, and it works, may be you should upgrade pip. – Bunyk Dec 2 '13 at 16:54
  • Yes, here is the answer to that: stackoverflow.com/a/14060138/816449 It works in 1.2.1.post1. – Bunyk Dec 2 '13 at 16:58
  • 1
    It appears this doesn't work for every package. E.g. pip show -f nbconvert gives Files: Cannot locate installed-files.txt. – Alex Coventry May 27 '16 at 12:54
  • It also doesn't work for packages installed using python setup.py develop. – akaihola Dec 16 '16 at 8:23
3

I use virtualenv with pip, so here are the steps I follow. Assume I'm working in the dave_venv virtual environment.

$ cat ~/.bashrc

export WORKON_HOME=/usr/local/virtualenvs

$ cd /usr/local/virtualenvs/dave_venv/lib/python2.6/site-packages
$ ls # This should show <your_package>.
$ cd <your_package>
$ ls # now you're looking at your package's files.
  • 1
    works in most cases, but not if the package installs any command-line scripts, which would end up in usr/local/bin.... also, some packages may install multiple modules... – hwjp Oct 31 '12 at 11:33
1

Two years later, most pip instances have show, however, not all packages have the installed-files.txt program for the subcommand to read.

A workaround is to fire up the python shell and do this:

>>> import eventlet
>>> eventlet.__path__
    ['/usr/lib/python2.7/dist-packages/eventlet']

where "eventlet" is the package I installed with pip.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.