Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing the dependencies of a package using pip [duplicate]

Tags:

python

pip

How do I list the dependencies for a package using pip?

like image 318
jan Avatar asked Jul 12 '12 21:07

jan


People also ask

How do I check the dependencies of a pip package?

Pip Check Command – Check Python Dependencies After Installation. Because pip doesn't currently address dependency issues on installation, the pip check command option can be used to verify that dependencies have been installed properly in your project. For example: $ pip check No broken requirements found.

How do I get all dependencies of a Python package?

Use the pipdeptree utility to gather a list of all dependencies, create a requirements. txt file listing all the dependencies, and then download them with the pip download command. Get the list of dependencies for a package from the setup.py file.

How do I list pip packages?

To do so, we can use the pip list -o or pip list --outdated command, which returns a list of packages with the version currently installed and the latest available. On the other hand, to list out all the packages that are up to date, we can use the pip list -u or pip list --uptodate command.

What are pip dependencies?

Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.


2 Answers

In current pip (version 1.3.1) you can see the dependencies of an installed package by using:

pip show <package> 
like image 192
kdb Avatar answered Sep 23 '22 07:09

kdb


Note that this answer from 2012 is out of date. First, the workaround, which the answer already said you probably shouldn't do in 2012, now you can't do it. If you want a similar workaround, you could use pip download, but it's even less likely to be what you want. Especially since pip show has been improved. Fortunately, the question has been marked as a dup of a later question, so there's no reason to read this answer except for historical purposes.


You can't, at least not directly.

You can import the pip module in your own code and download the requirements file and then iterate through it. Or, from the command line, you can pip install --no-install --verbose.

But really, unless this is something you need to automate, it's probably easier to just go to http://pypi.python.org/ and search for the package there instead of using pip.

like image 27
abarnert Avatar answered Sep 20 '22 07:09

abarnert