forked from hlasimpk/af3_mmseqs_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check_chai1 function to chai1/check_install.py for chai_lab insta…
…llation
- Loading branch information
Showing
2 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
import subprocess | ||
import sys | ||
|
||
logger = logging.getLogger("logger") | ||
|
||
|
||
def check_chai1(): | ||
try: | ||
import chai_lab as _ # noqa F40 | ||
except (ImportError, ModuleNotFoundError): | ||
try: | ||
import boltz1 as _ # noqa F401 | ||
|
||
no_deps = True | ||
except (ImportError, ModuleNotFoundError): | ||
no_deps = False | ||
logger.info("Installing chai_lab package") | ||
logger.info("No dependencies will be installed") if no_deps else None | ||
cmd = [sys.executable, "-m", "pip", "install", "chai_lab", "--no-cache-dir"] | ||
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) |