Getting all the nested dependancies for a Conda (Anaconda) Python Package

Finding out what additional packages are installed (and where they come from) when using conda.

Daniel Ellis Research
2 min readAug 18, 2023
Photo by David Clode on Unsplash

Setup

Installation of conda-tree

We begin by installing the conda-tree package. This allows us to browse the dependancies of our environment.

conda install -c conda-forge conda-tree

#or (faster)

mamba install conda-tree

Testing out conda-tree

To check that our installation works, we can see which packages in our current environment are not depended on by any others (these are called leaves). This can be useful in determining what we can delete, without breaking the environment.

$$> conda tree leaves

cmor
conda-tree
ipykernel
gfortran_osx-64

In this example I am looking at the an environment created to run the Climate Model Output Rewriter (CMOR).

Viewing all dependancies of a package

Now we have a working environment, I wish to locate the dependancies of the cmor package in the environment above.

--

--

Daniel Ellis Research

Research Software Engineer specialising in High-Performance Computing and Data Visualisation. — PhD in Atmospheric Chemistry and Masters in Theoretical Physics.