Is there a tool for analyzing Conda dependencies as we do have in Maven?
ie: In Java projects (maven based) you say mvn dependency:tree
and it shows all the dependencies (along with transitive dependencies) in a readable tree format.
I was wondering if we have something in python based project to analyze Conda dependencies.
Any suggestions?
List the dependencies that a specific package requires to run: conda search package_name --info. Find your installation's package cache directory: conda info. Find package dependencies. By default, Anaconda/Miniconda stores packages in ~/anaconda/pkgs/ (or ~/opt/pkgs/ on macOS Catalina).
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.
Conda provides many of the features found in pip, virtualenv, venv and pyenv. However it is a completely separate tool that will manage Python dependencies differently, and only works in Conda environments. Conda analyzes each package for compatible dependencies, and how to install them without conflict.
The pip install <package> command always looks for the latest version of the package and installs it. It also searches for dependencies listed in the package metadata and installs them to ensure that the package has all the requirements that it needs.
Check out conda-tree.
Usage (based on the conda-tree webpage):
# version
$ conda-tree --version
conda-tree 0.0.4
# packages that no other package depends on
$ conda-tree leaves
['samtools','bcftools',...]
# dependencies of a specific package
$ conda-tree depends samtools
['curl', 'xz', 'libgcc', 'zlib']
# which packages depend on a specific package
$ conda-tree whoneeds xz
['samtools', 'bcftools', 'htslib', 'python']
# dependency cycles
$ conda-tree cycles
pip -> python -> pip
pip -> wheel -> python -> pip
# query a different conda prefix/env
$ conda-tree -p /conda/envs/trinity leaves
['trinity']
# query by name
$ conda-tree -n trinity leaves
['trinity']
For dependencies installed with pip
, check out pipdeptree
. It will return a dependency tree of the packages (installed with pip
. See the documentation)
try:
pipdeptree
Or if you are looking for the leaves only
pipdeptree --freeze --warn silence | grep -P '^[\w0-9\-=.]+'
See also this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With