83

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

3 Answers 3

114

You could do that by using command:

pip show -f <package>
5
  • Does not work for me, pip: error: No command by the name pip show. (Using pip 1.1)
    – Zitrax
    Dec 2, 2013 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, 2013 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, 2013 at 16:58
  • 2
    It appears this doesn't work for every package. E.g. pip show -f nbconvert gives Files: Cannot locate installed-files.txt. May 27, 2016 at 12:54
  • It also doesn't work for packages installed using python setup.py develop.
    – akaihola
    Dec 16, 2016 at 8:23
5

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.

4

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.
2
  • 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, 2012 at 11:33
  • @hwjp Do you know the answer to: Find which python package owns a binary?
    – Tom Hale
    Apr 27, 2019 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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