31

I'm trying to get a codebase running on my machine, and pip isn't finding some of the dependencies. It seems to find them on another machine, so I'd like to see which repos pip is using on the two machines so I can compare.

How can I do this?

Jack M
  • 4,769
  • 6
  • 43
  • 67
  • @JonClements Both of those just list installed packages, don't they? – Jack M Aug 16 '18 at 10:36
  • Are you maybe after: https://stackoverflow.com/questions/11147667/is-there-a-way-to-list-pip-dependencies-requirements ? – Jon Clements Aug 16 '18 at 10:37
  • @JonClements No? Maybe I'm not using the right terminology. When you tell pip to install a package with a certain name, it has to look that up online somewhere, to map the name onto an actual set of files to download. I want it to list all of the somewheres that it checks to get that information. Presumably in the form of a list of URLs or domains. – Jack M Aug 16 '18 at 10:39
  • 1
    Ahhh... only a couple of places by default unless told otherwise by command line arguments - probably what you're after starts at https://pip.pypa.io/en/stable/reference/pip_install/#finding-packages – Jon Clements Aug 16 '18 at 10:43
  • have you tried **pip show (package_name)** .... it results in info where there are points called **Requires** and **Requires_by**... ?.. this may help out to straight out the dependencies...or if in linux try **which pip** to get the pip running source...might help ? – Akson Aug 16 '18 at 10:49

2 Answers2

25

Update for 21.1.2

(copied from @Bryan Roach's comment):

pip download --no-cache-dir --verbose "foo<0" 2>&1 |grep 'location(s) to search' -A5

Update for pip>=20

The repositories are now listed by default, no need to pass the --verbose arg:

$ pip download --no-cache-dir "foo<0" 2>&1 | grep Looking
Looking in indexes: https://pypi.org/simple, https://my-index.local, http://127.0.0.1:9000

Original answer

The repositories where pip searches for packages are displayed when using --verbose flag: pip install --verbose ... or pip download --verbose .... Specify some non-existent requirement so pip does not actually download/install anything. Example:

$ pip download --no-cache-dir --verbose "foo<0" 2>&1 | grep Looking
Looking in indexes: https://pypi.org/simple, https://my-index.local, http://127.0.0.1:9000
gndps
  • 461
  • 3
  • 13
hoefling
  • 59,418
  • 12
  • 147
  • 194
  • 7
    My output was formatted a bit differently. Perhaps pip has been updated. This worked for my case: `pip download --no-cache-dir --verbose "foo<0" 2>&1 |grep 'location(s) to search' -A5` – Bryan Roach Feb 26 '20 at 20:36
  • 1
    @BryanRoach good catch - looks like the verbose output has changed. The command provided in the answer continues to work without the `--verbose` arg, though. – hoefling Feb 29 '20 at 12:49
  • 1
    I have pip version 22.3.1 and it seems like verbose is additive now and it needs a double verbose to get the result described above: `pip download --no-cache-dir -v -v "foo<0"` – oliver_t Feb 14 '23 at 15:57
6

Just run from a terminal : pip config list

Lucas B
  • 2,183
  • 1
  • 22
  • 22