From 454c2c0952703e44feefbba59ce585bf27fb2997 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sat, 8 Jul 2023 08:38:45 -0400 Subject: [PATCH] version of _find_root() that works in conda environment --- invokeai/app/services/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/app/services/config.py b/invokeai/app/services/config.py index 5efe23bdc9..aa067d9d2e 100644 --- a/invokeai/app/services/config.py +++ b/invokeai/app/services/config.py @@ -325,11 +325,11 @@ class InvokeAISettings(BaseSettings): help=field.field_info.description, ) def _find_root()->Path: - venv = os.environ.get("VIRTUAL_ENV") + venv = Path(os.environ.get("VIRTUAL_ENV") or ".") if os.environ.get("INVOKEAI_ROOT"): root = Path(os.environ.get("INVOKEAI_ROOT")).resolve() - elif any([Path(venv, '..', x).exists() for x in [INIT_FILE, LEGACY_INIT_FILE, MODEL_CORE]]): - root = Path(venv, "..").resolve() + elif any([(venv.parent/x).exists() for x in [INIT_FILE, LEGACY_INIT_FILE, MODEL_CORE]]): + root = (venv.parent).resolve() else: root = Path("~/invokeai").expanduser().resolve() return root