mamba repoquery
While Mamba is primarily a drop-in replacement for Conda, one of the extra features it provides is solid functionality for dependency and reverse dependency querying through its repoquery
command. Queries can be performed either
- restricted to specific environment, by running the command with the environment activated; or
- using repodata from channel(s), by using the
--channel,-c
flag(s).
Demo
Note that this is years out from the original question, so I'm just going demo with a mpi4py
install and use the versions that get installed.
$ mamba create -n so-mpi4py mpi4py
## installs 24 packages
$ conda activate so-mpi4py
(so-mpi4py) $ mamba repoquery whoneeds mpich
__ __ __ __
/ \ / \ / \ / \
/ \/ \/ \/ \
███████████████/ /██/ /██/ /██/ /████████████████████████
/ / \ / \ / \ / \ \____
/ / \_/ \_/ \_/ \ o \__,
/ _/ \_____/ `
|/
███╗ ███╗ █████╗ ███╗ ███╗██████╗ █████╗
████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
██╔████╔██║███████║██╔████╔██║██████╔╝███████║
██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
██║ ╚═╝ ██║██║ ██║██║ ╚═╝ ██║██████╔╝██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝
mamba (0.19.0) supported by @QuantStack
GitHub: https://github.com/mamba-org/mamba
Twitter: https://twitter.com/QuantStack
█████████████████████████████████████████████████████████████
Executing the query mpich
Name Version Build Depends Channel
────────────────────────────────────────────────────────────────────────
mpi4py 3.1.3 py310hd348148_0 mpich >=3.4,<4.0.0a0 conda-forge/osx-64
Personally, I usually use the tree format, with
(so-mpi4py) $ mamba repoquery whoneeds --tree mpich
mpich[3.4.2]
└─ mpi4py[3.1.3]
Real-World Example
More of a testimonial to its usefulness, I had noticed at some point that one of my R environments somehow ended up with Python installed. I'm very strict about this, so I reached for mamba repoquery whoneeds
and found:
(bioc_3_12) host:dir usr$ mamba repoquery whoneeds -t python
Executing the query python
python[3.9.2]
├─ numpy[1.20.2]
│ └─ colormath[3.0.0]
│ └─ spectra[0.0.11]
│ └─ r-rspectra[0.16_0] # <- this package is the culprit!
│ └─ r-uwot[0.1.10]
├─ networkx[2.5]
│ └─ colormath already visited
├─ certifi[2021.5.30]
│ └─ setuptools[49.6.0]
│ ├─ networkx already visited
│ └─ pip[21.0.1]
├─ python_abi[3.9]
│ ├─ numpy already visited
│ ├─ certifi already visited
│ └─ setuptools already visited
├─ colormath already visited
├─ spectra already visited
├─ decorator[4.4.2]
│ └─ networkx already visited
├─ wheel[0.36.2]
│ └─ pip already visited
├─ pip already visited
└─ setuptools already visited
Turned out the r-spectra
package recipe in Conda Forge had misstated one of its dependencies to be a Python package (spectra
) rather than a C++ dynamic library (spectralib
).