-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Summary
The package dependency graph feature currently requires mamba because it uses mamba repoquery depends --json <pkg>. However, recent versions of conda with conda-libmamba-solver now support the same repoquery depends command.
Background Research
Current Implementation
The pkg_depends method in envmanager.py previously checked is_mamba() and returned early if conda was detected:
if not self.is_mamba():
self.log.warning(
"Package manager '{}' does not support dependency query.".format(
self.manager
)
)
return {pkg: None}Discovery: conda-libmamba-solver provides repoquery
According to the conda 25.x documentation:
Note: The
conda repoquery dependscommand is provided by theconda-libmamba-solver.
This means users with conda-libmamba-solver installed can use:
conda repoquery depends --json <package>The JSON output format is identical to mamba's output, making it a drop-in replacement.
Preliminary Fix (Tested Successfully)
We temporarily removed the is_mamba() check, allowing both mamba and conda to use repoquery depends. This was tested successfully in an environment with:
- conda 24.11.3
- conda-libmamba-solver installed
Both the package dependency graph visualization and environment listing work correctly.
Proposed Implementation
Option 1: Simple removal of mamba check (current temporary fix)
- Pros: Simple, works for users with libmamba-solver
- Cons: Will fail for users without libmamba-solver
Option 2: Try/catch with graceful fallback
async def pkg_depends(self, pkg: str) -> Dict[str, List[str]]:
try:
ans = await self._execute(self.manager, "repoquery", "depends", "--json", pkg)
# ... process response
except Exception:
self.log.warning("repoquery not available. Install mamba or conda-libmamba-solver.")
return {pkg: None}Option 3: Explicit detection of repoquery support
- Run
conda repoquery --helpor similar to detect availability - Cache the result like we do for manager detection
Tasks
- Decide on implementation approach
- Add proper error handling for environments without repoquery support
- Update user-facing error message in
PkgGraph.tsxto mention conda-libmamba-solver as alternative to mamba - Add tests for conda repoquery path
- Update documentation
Related Files
mamba_gator/envmanager.py-pkg_depends()methodpackages/common/src/components/PkgGraph.tsx- Frontend error message