Skip to content

Commit 6ff0ddd

Browse files
fix: smarter CONDA_PREFIX resolution during hpacker install (#93)
1 parent 3496aca commit 6ff0ddd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/bioemu/hpacker_setup/setup_hpacker.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
import subprocess
44

5+
from bioemu.utils import get_conda_prefix
6+
57
HPACKER_INSTALL_SCRIPT = os.path.join(
68
os.path.dirname(os.path.realpath(__file__)), "setup_sidechain_relax.sh"
79
)
@@ -19,12 +21,9 @@ def ensure_hpacker_install(
1921
Ensures hpacker and its dependencies are installed under conda environment
2022
named `envname`
2123
"""
22-
conda_root = os.getenv("CONDA_ROOT", None)
23-
if conda_root is None:
24-
# Attempt $CONDA_PREFIX_1
25-
conda_root = os.getenv("CONDA_PREFIX_1", None)
26-
assert conda_root is not None, "conda required to install hpacker environment"
27-
conda_envs = os.listdir(os.path.join(conda_root, "envs"))
24+
conda_root = get_conda_prefix()
25+
env_dir = os.path.join(conda_root, "envs")
26+
conda_envs = os.listdir(os.path.join(conda_root, "envs")) if os.path.exists(env_dir) else []
2827

2928
if envname not in conda_envs:
3029
logger.info("Setting up hpacker dependencies...")

0 commit comments

Comments
 (0)