diff --git a/sandbox/dexorder/conda_manager.py b/sandbox/dexorder/conda_manager.py index f764a8d3..04e60b5c 100644 --- a/sandbox/dexorder/conda_manager.py +++ b/sandbox/dexorder/conda_manager.py @@ -90,9 +90,14 @@ def get_installed_packages() -> Set[str]: Returns: Set of package names """ + conda_exe = get_conda_executable() + if not conda_exe: + log.error("Failed to list conda packages: conda executable not found") + return set() + try: result = subprocess.run( - [sys.executable, "-m", "conda", "list", "--json"], + [str(conda_exe), "list", "-n", "dexorder", "--json"], capture_output=True, text=True, timeout=30, @@ -177,9 +182,20 @@ def install_packages(packages: list[str], data_dir: Optional[Path] = None) -> di # Install missing packages log.info(f"Installing conda packages: {to_install}") + conda_exe = get_conda_executable() + if not conda_exe: + log.error("Failed to install packages: conda executable not found") + return { + "success": False, + "installed": [], + "skipped": skipped, + "failed": to_install, + "error": "conda executable not found", + } + try: result = subprocess.run( - [sys.executable, "-m", "conda", "install", "-y", "-c", "conda-forge"] + to_install, + [str(conda_exe), "install", "-y", "-n", "dexorder", "-c", "conda-forge"] + to_install, capture_output=True, text=True, timeout=300, # 5 minute timeout @@ -247,9 +263,18 @@ def remove_packages(packages: list[str]) -> dict: log.info(f"Removing conda packages: {packages}") + conda_exe = get_conda_executable() + if not conda_exe: + log.error("Failed to remove packages: conda executable not found") + return { + "success": False, + "removed": [], + "error": "conda executable not found", + } + try: result = subprocess.run( - [sys.executable, "-m", "conda", "remove", "-y"] + packages, + [str(conda_exe), "remove", "-y", "-n", "dexorder"] + packages, capture_output=True, text=True, timeout=120,