From b7d74a8df151b086c5b4836827d7251b7de8241f Mon Sep 17 00:00:00 2001 From: Luc Elliott Date: Wed, 13 Aug 2025 09:17:38 +0100 Subject: [PATCH 1/5] improved dependency installation process for chai --- abcfold/chai1/check_install.py | 53 +++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/abcfold/chai1/check_install.py b/abcfold/chai1/check_install.py index 90b00e4..39aa7ae 100644 --- a/abcfold/chai1/check_install.py +++ b/abcfold/chai1/check_install.py @@ -5,7 +5,7 @@ logger = logging.getLogger("logger") -CHAI_VERSION = "0.6.0" +CHAI_VERSION = "0.6.1" def check_chai1(): @@ -34,7 +34,7 @@ def check_chai1(): ) except (ImportError, ModuleNotFoundError): try: - import boltz1 as _ # noqa F401 + import boltz as _ # noqa F401 no_deps = True except (ImportError, ModuleNotFoundError): @@ -51,15 +51,42 @@ def check_chai1(): ] cmd.append("--no-deps") if no_deps else None logger.info("Running %s", " ".join(cmd)) - with subprocess.Popen( - cmd, - stdout=sys.stdout, - stderr=subprocess.PIPE, - ) as proc: - proc.wait() - if proc.returncode != 0: - if proc.stderr: - logger.error(proc.stderr.read().decode()) - raise subprocess.CalledProcessError(proc.returncode, proc.args) + run_command_using_sys(cmd) + if no_deps: + cmd = [ + sys.executable, + "-m", + "pip", + "install", + "antipickle", + "typer", + "jaxtyping", + "beartype", + "pandera", + ] + logger.info("Installing dependencies: %s", " ".join(cmd)) + run_command_using_sys(cmd) + except Exception as e: + logger.error("Error while checking or installing chai_lab: %s", e) + raise ImportError( + "chai_lab package is not installed. " + "Please install it using `pip install chai_lab`." + ) from e + + logger.info(f"Running Chai version: {CHAI_VERSION}") + - # add pytroch lightning to install +def run_command_using_sys(command: list[str]) -> None: + """Run a command using sys.executable.""" + cmd = [sys.executable] + command + logger.info("Running command: %s", " ".join(cmd)) + with subprocess.Popen( + cmd, + stdout=sys.stdout, + stderr=subprocess.PIPE, + ) as proc: + proc.wait() + if proc.returncode != 0: + if proc.stderr: + logger.error(proc.stderr.read().decode()) + raise subprocess.CalledProcessError(proc.returncode, proc.args) From 31d396225d902164e18dfe59c648cbf65140fa7a Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 13 Aug 2025 09:41:33 +0100 Subject: [PATCH 2/5] Add gemmi to dependency installation and improve command logging --- abcfold/chai1/check_install.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/abcfold/chai1/check_install.py b/abcfold/chai1/check_install.py index 39aa7ae..135106d 100644 --- a/abcfold/chai1/check_install.py +++ b/abcfold/chai1/check_install.py @@ -63,6 +63,7 @@ def check_chai1(): "jaxtyping", "beartype", "pandera", + "gemmi", ] logger.info("Installing dependencies: %s", " ".join(cmd)) run_command_using_sys(cmd) @@ -78,10 +79,9 @@ def check_chai1(): def run_command_using_sys(command: list[str]) -> None: """Run a command using sys.executable.""" - cmd = [sys.executable] + command - logger.info("Running command: %s", " ".join(cmd)) + logger.info("Running command: %s", " ".join(command)) with subprocess.Popen( - cmd, + command, stdout=sys.stdout, stderr=subprocess.PIPE, ) as proc: From 4b6130ed14e4ae202a834d00cf354ef52121b952 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 13 Aug 2025 10:15:51 +0100 Subject: [PATCH 3/5] Enhance error handling in installation checks for Boltz and Chai packages --- abcfold/boltz/check_install.py | 8 ++++++++ abcfold/chai1/check_install.py | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/abcfold/boltz/check_install.py b/abcfold/boltz/check_install.py index 660b3ff..f782eb3 100644 --- a/abcfold/boltz/check_install.py +++ b/abcfold/boltz/check_install.py @@ -19,6 +19,11 @@ def check_boltz(): ) as proc: stdout, stderr = proc.communicate() if proc.returncode != 0: + if "Package(s) not found:" in stderr.decode(): + + raise ModuleNotFoundError( + "Boltz package not found." + ) raise subprocess.CalledProcessError(proc.returncode, cmd, stderr) version = None @@ -41,7 +46,10 @@ def check_boltz(): "pip", "install", f"boltz=={BOLTZ_VERSION}", + "cuequivariance_torch", + "cuequivariance_ops_torch" "--no-cache-dir", + ] logger.info("Running %s", " ".join(cmd)) diff --git a/abcfold/chai1/check_install.py b/abcfold/chai1/check_install.py index 6093238..52258dd 100644 --- a/abcfold/chai1/check_install.py +++ b/abcfold/chai1/check_install.py @@ -21,6 +21,11 @@ def check_chai1(): ) as proc: stdout, stderr = proc.communicate() if proc.returncode != 0: + if "Package(s) not found:" in stderr.decode(): + + raise ModuleNotFoundError( + "Chai_lab package not found." + ) raise subprocess.CalledProcessError(proc.returncode, cmd, stderr) version = None @@ -36,7 +41,6 @@ def check_chai1(): except (ImportError, ModuleNotFoundError): try: import boltz as _ # noqa F401 - import boltz as _ # noqa F401 no_deps = True except (ImportError, ModuleNotFoundError): @@ -65,7 +69,7 @@ def check_chai1(): "jaxtyping", "beartype", "pandera", - "gemmi", + "matplotlib", ] logger.info("Installing dependencies: %s", " ".join(cmd)) run_command_using_sys(cmd) From 9adf55a331005751134baa95c01e00f4b57cce6b Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 13 Aug 2025 10:20:30 +0100 Subject: [PATCH 4/5] Fix error handling for missing Boltz and Chai packages in installation checks --- abcfold/boltz/check_install.py | 2 +- abcfold/chai1/check_install.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/abcfold/boltz/check_install.py b/abcfold/boltz/check_install.py index f782eb3..99b4aba 100644 --- a/abcfold/boltz/check_install.py +++ b/abcfold/boltz/check_install.py @@ -20,7 +20,7 @@ def check_boltz(): stdout, stderr = proc.communicate() if proc.returncode != 0: if "Package(s) not found:" in stderr.decode(): - + raise ModuleNotFoundError( "Boltz package not found." ) diff --git a/abcfold/chai1/check_install.py b/abcfold/chai1/check_install.py index 52258dd..13fa2b7 100644 --- a/abcfold/chai1/check_install.py +++ b/abcfold/chai1/check_install.py @@ -22,7 +22,7 @@ def check_chai1(): stdout, stderr = proc.communicate() if proc.returncode != 0: if "Package(s) not found:" in stderr.decode(): - + raise ModuleNotFoundError( "Chai_lab package not found." ) From 269768138208e02d8814c5cb9b3809892b71be1d Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 13 Aug 2025 10:38:49 +0100 Subject: [PATCH 5/5] Update cuequivariance_ops_torch dependency to include CUDA version in installation check --- abcfold/boltz/check_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abcfold/boltz/check_install.py b/abcfold/boltz/check_install.py index 99b4aba..ff66de4 100644 --- a/abcfold/boltz/check_install.py +++ b/abcfold/boltz/check_install.py @@ -47,7 +47,7 @@ def check_boltz(): "install", f"boltz=={BOLTZ_VERSION}", "cuequivariance_torch", - "cuequivariance_ops_torch" + "cuequivariance_ops_torch-cu12", "--no-cache-dir", ]