How do I search for an available Python package using pip?

Question:

I would like to be able to search for an available Python package using pip (on the terminal). I would like a functionality similar to apt-cache in Ubuntu. More specifically, I would like to

  1. be able to search for packages given a term (similar to apt-cache search [package-name]), and
  2. list all available packages.
Asked By: CodeKingPlusPlus

||

Answers:

To search for a package, issue the command

pip search [package-name]
Answered By: ijmarshall
  1. To search use pip search QUERY

    Use pip help and pip help COMMAND to learn about all available commands and their options.

  2. You can find a complete list of packages here:

    https://pypi.org/

    An index with simpler markup for easier automatic consumption can be found here:

    https://pypi.org/simple/

Answered By: Daniel Hepper

To see a list of all available packages try running

pip search *
Answered By: bcarroll

Pip search can solve your problem if you don’t want to use it too often. But after regular use I found it hard to read, slow to use and it didn’t show infos I sometimes needed (upload time, license, size, etc) so I ended up writing an alternative which I think turned out pretty nice.

It is called yip and it is like pip search on steroids. It supports regex search, colorized output and a menu system which makes installing from search result super easy. If you want to know more or see a screencap check it out on GitHub.

Answered By: Balázs Sáros

As of Dec 2020, pip search will not work (more).

The current feasible solution is to search online, on: https://pypi.org/ (reference also provided by previous comments).

If anyone hitting the following error:

xmlrpc.client.Fault: <Fault -32500: "RuntimeError: PyPI's XMLRPC API has been temporarily
disabled due to unmanageable load and will be deprecated in the near future.
See https://status.python.org/ for more information.">

as stated in #5216:

As an update: XMLRPC search does still remain disabled.

because:

As noted in #5216 (comment), a group of servers are hitting the pip search entry point, to an extent that PyPI cannot sustain that load with the current architecture of how pip search works.

Update: As a CLI alternative to pip, that uses PyPI registry, one can use :

$ poetry search <package>
Answered By: azbarcea

As of December the 14th, 2020, the pip search functionality has been disabled :

$ pip search cast
ERROR: XMLRPC request failed [code: -32500]
RuntimeError: PyPI's XMLRPC API is currently disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.

Alternatives

Here’s a little tool called pip_search I’ve just found that does a simple search but it does the job.

This is pip_search v0.0.6 output:

$ pip_search pulsemixer
----------------  -------------------------------------------------------------------------------
Name              Description

pulsemixer        pulsemixer - CLI and curses mixer for PulseAudio
pulsectl-asyncio  Asyncio frontend for the pulsectl Python bindings of libpulse
pulsectl          Python high-level interface and ctypes-based bindings for PulseAudio (libpulse)
----------------  -------------------------------------------------------------------------------

UPDATE

pip_search has been updated, each folder is a clickable (CTRL+click) URL for each project, now it looks like this:

$ pip_search pulsemixer
                                             https://pypi.org/search/?q=pulsemixer                                              
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Package             ┃ Version ┃ Released     ┃ Description                                                                     ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│   pulsemixer       │ 1.5.1   │ Apr 11, 2020 │ pulsemixer - CLI and curses mixer for PulseAudio                                │
│   pulsectl-asyncio │ 0.1.7   │ Jun 13, 2021 │ Asyncio frontend for the pulsectl Python bindings of libpulse                   │
│   pulsectl         │ 21.5.18 │ May 22, 2021 │ Python high-level interface and ctypes-based bindings for PulseAudio (libpulse) │
└─────────────────────┴─────────┴──────────────┴─────────────────────────────────────────────────────────────────────────────────┘

To install it, just type:

pip install pip_search


There’s also another tool that I’ve just tried called pypisearch.

To install it, just type: pip install pypisearch

And it works like this:

$ python -m pypisearch pulsemixer
pulsemixer (1.5.1)        [installed 1.5.0] pulsemixer - CLI and curses mixer for PulseAudio
pulsectl-asyncio (0.1.5)  Asyncio frontend for the pulsectl Python bindings of libpulse
pulsectl (21.3.4)         Python high-level interface and ctypes-based bindings for PulseAudio (libpulse)
Answered By: SebMa

Use: pip show <package_name>

Answered By: Hache Laborde

After Dec 2020, search doesn’t work. But index does.

pip index versions <package_name>

Note: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.

EDIT: (You can also use pip index -vv versions <package> to get verbose output.)

Answered By: cowlinator

Just simply install a non-existing version of the package that you want to search. By this way, you can find not only the stable releases, but also the alpha, beta versions like 1.2.3a2.

pip install [package]==666.666.666
Answered By: C .MS
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.