From cea1134a30ec1eb7c3b9847ff0b16e6df6445ede Mon Sep 17 00:00:00 2001 From: daklauss Date: Mon, 12 Jan 2026 10:48:39 +0100 Subject: [PATCH] Add conda env to path if missing --- cadet/cadet.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cadet/cadet.py b/cadet/cadet.py index 5a63636..956faf1 100644 --- a/cadet/cadet.py +++ b/cadet/cadet.py @@ -5,6 +5,7 @@ import subprocess from typing import Optional import warnings +import sys from addict import Dict @@ -366,9 +367,21 @@ def autodetect_cadet() -> Optional[Path]: path = shutil.which(executable) if path is None: - raise FileNotFoundError( - "Could not autodetect CADET installation. Please provide path." - ) + + dll_paths = [ + str(Path(sys.prefix) / 'Library' / 'bin'), + str(Path(sys.prefix) / 'bin'), + ] + current_path = os.environ.get('PATH', '') + new_path = os.pathsep.join(dll_paths) + os.pathsep + current_path + os.environ['PATH'] = new_path + + path = shutil.which(executable) + + if path is None: + raise FileNotFoundError( + "Could not autodetect CADET installation. Please provide path." + ) cli_path = Path(path) cadet_root = cli_path.parent.parent if cli_path else None