138

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.
nbro
  • 15,395
  • 32
  • 113
  • 196
CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216

9 Answers9

155

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>

Update [2023-05-01]: Altenative: [pip_search](https://github.com/victorgarric/pip_search) is an alternative to pip search and using shell aliases, one can overwrite the pip search with the actual execution of pip_search (complements to Johan)


azbarcea
  • 3,323
  • 1
  • 20
  • 25
  • 3
    for a minimalistic package name search perhaps `wget -O - https://pypi.org/simple/ | grep -i [package name]` You can then get more info if desired at **`https://pypi.org/project/`** `[project name]` *(The match from the grep command between `>....<`)* – Pau Coma Ramirez Feb 18 '21 at 18:58
  • 1
    "minimalistic" indeed: [pypi.org/simple](https://pypi.org/simple/) is 290,000 package names `0 .. zzzZZZzzz`, that's it; /project/ has only links to tar / whl. Does anyone know of a pypi mirror with only package*.dist-info for querying (yolk, qypi), no wheels ? – denis Mar 08 '21 at 09:55
  • Why I've downvoted : the question clearly asks "How do I search for an available Python package using pip?" not "why". This answer doesn't give any clue how for help – dlewin Dec 24 '21 at 15:47
  • 2
    The Answer to the Question is "You Can't." The ONLY answers are work-arounds at this point. https://status.python.org/incidents/grk0k7sz6zkp => "Resolved: XMLRPC Search has been permanently disabled. Jan 03, 2022" – michael Jan 10 '22 at 12:01
  • 2
    `poetry` so far seems a solid replacement for this missing functionality. Install e.g., either as: `pip3 install --user poetry` (or `pip2`), or e.g., macOS you either use `pip` or can also `sudo port install poetry` (if using macports). See https://pypi.org/project/poetry – michael Jan 10 '22 at 12:19
  • 1
    `pip search x-package-name` can be used with the `pip_search` package and an alias bash script described [here](https://github.com/victorgarric/pip_search) to the file where you inserted the script e.g. .bash_alias. Then just run `source ~/.bash_alias` and it will work immediately. – Johan Apr 30 '23 at 16:01
85

To search for a package, issue the command

pip search [package-name]
nbro
  • 15,395
  • 32
  • 113
  • 196
ijmarshall
  • 3,373
  • 2
  • 19
  • 13
  • Also, if anyone forgets the command you can find it by typing into the command line: pip -h – DJ Poland Jul 25 '18 at 01:23
  • 77
    "SEARCH" does NOT work anymore (this is by desing) (as of 01/2021) - see https://stackoverflow.com/a/65485498/4940240 answer ny @azcarbea below – MacMartin Jan 15 '21 at 09:29
  • 3
    I'm getting "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." – Lars Ericson Apr 10 '22 at 14:30
  • 2
    This is so far out of date, it should be removed. – Rich Lysakowski PhD Nov 05 '22 at 03:14
47

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)
informatik01
  • 16,038
  • 10
  • 74
  • 104
SebMa
  • 4,037
  • 29
  • 39
13
  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/

Daniel Hepper
  • 28,981
  • 10
  • 72
  • 75
12

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.)

cowlinator
  • 7,195
  • 6
  • 41
  • 61
  • 1
    Seems to be removed. – bomben Mar 25 '22 at 05:42
  • 1
    `pip index versions requests` works for me with `pip 22.0.4` on Windows. Can you provide more information about what's wrong? Maybe an error message? – cowlinator Mar 25 '22 at 18:20
  • 1
    Don't want to necro, but this works fine for me in pip 21.2.3 while `pip search` is deprecated and was blocked by my work vpn. I understand why `pip search` is the accepted answer, but it's not really a solution going forward with newer versions of pip. While experimental, at least this solution is not deprecated. – gollum18 Apr 05 '22 at 20:25
  • 2
    This is the best answer for me because there is nothing to install. It works fine for me on Windows as of 2022.11.04. – Rich Lysakowski PhD Nov 05 '22 at 03:11
5

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.

Balázs Sáros
  • 495
  • 6
  • 12
3

To see a list of all available packages try running

pip search *
bcarroll
  • 1,727
  • 16
  • 14
  • 1
    then you can pipe to `grep`. kind of like `yum list | grep PATTERN`. – Trevor Boyd Smith May 23 '19 at 16:03
  • I just did that, got a list of 102 packages. Asterisk does not appear to work as wildcard. I believe it finds actual asterisk somewhere in the package description. Did a few other tests with asterisk with no apparent system to the results. – fsando Jun 01 '19 at 09:05
  • 2
    Note that star `*` is a glob in many shells, so it will expand to a list of filenames in the current directory. You could get around that by escaping it with quotes or a backslash. – wjandrea Jun 20 '19 at 23:18
  • I got no results from this using pip 19.1.1. – wjandrea Jun 20 '19 at 23:21
  • It shows exactly 100 packages + 2 log lines (pip 20.0.2). `pip search` has max display packages count. – sir__finley Mar 03 '20 at 09:56
0

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
C .MS
  • 41
  • 3
-2

Use: pip show <package_name>

  • 4
    This only works if you already have the package installed. The question is asking for functionality to search for available packages i.e. ones not installed. Therefore this is not a solution – jezza_99 Jan 17 '22 at 02:09