How to visually display dependencies of a package?

12,983

Solution 1

debtree

According to the application's website, the debtree package provides "package dependency graphs on steroids".

Note: This is also very useful when planning software upgrades. This application is able to graph dependencies against packages which have not yet been installed on your system. This will read from the sources.list file (usually located at /etc/apt/sources.list) and it will perform a live query using that list.

The following diagram is an example of running debtree against the package dpkg. Here is a map of its dependencies:

To install debtree from the command line(Ctrl+Alt+t) enter the following command:

sudo apt-get install debtree

Usage

  • Create a .dot file (a directed graph drawing - see the man dot manpage):

      debtree --with-suggests <package> >out.dot
    
  • Create a graph (PNG) from a .dot file:

      dot -T png -o out.png out.dot
    
  • Create a graph (Postscript) and view it using Okular:

      debtree <package> | dot -Tps | okular - &
    

Be aware that when running this application against larger packages (e.g. gedit), the images can quickly become unwieldy and illegible.

Note that apt-rdepends can also be used in a similar manner, but piping output into a graphic is a bit more convoluted, in my opinion.

See also: Ubuntu debtree man page

Solution 2

Maybe not so "graphical" but if you prefer not installing any extra packages you can run

apt-cache rdepends <package>

Take a look also to depends option.

You also have:

  • apt rdepends <package>
  • Use this script, apt-rdepends-tree <package>
  • apt-rdepends <package> or as debtree apt-rdepends --dotty package | springgraph > dependencies.png

Solution 3

The command-line tool Apitude is a great tool for looking at dependencies. no fancy graphs, but it does give you a nice hierarchic representation of dependencies for a specific package.

Share:
12,983

Related videos on Youtube

Anton Kuzmin
Author by

Anton Kuzmin

I work with GPUs on deep learning and computer vision.

Updated on September 18, 2022

Comments

  • Anton Kuzmin
    Anton Kuzmin almost 2 years

    This is just for fun and curiosity: is there a tool using which I can visually see the dependencies of a package as a graph?

    That is, the packages that a given package depends on. This can be a command-line tool that displays using ASCII graphics (like tree or Mercurial's graphlog) or a GUI tool that shows the dependency graph visually. Any other combination of tools that can show the dependencies visually works too.

    • Admin
      Admin over 11 years
      And what would the axes of the graph be?
    • Anton Kuzmin
      Anton Kuzmin over 11 years
      @vasa1: Vertices would be packages and edges are the dependencies.
  • Anton Kuzmin
    Anton Kuzmin over 11 years
    Nathan Cazell: Could you elaborate how I can view this hierarchical graph for a given package?
  • Ntc
    Ntc over 11 years
    when you open Aptitude just search for a package using / then hit enter for the package you want and it will show all the information about the package including a dependency tree with unmet dependencies and also conflicting packages.
  • Anton Kuzmin
    Anton Kuzmin over 11 years
    Nathan Cazell: Are you referring to the command-line aptitude tool?
  • Ntc
    Ntc over 11 years
    Edited. Sorry for not clarifying earlier
  • logoff
    logoff about 8 years
    --no-skip or even --show-all are very useful options to include more packages like libc6.