Skip to content

Commit f25f718

Browse files
committed
%CONDA_PREFIX%\bin does not exist anymore on Windows
Only %CONDA_PREFIX%\Library\bin exists.
1 parent 37642a5 commit f25f718

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

khiops/core/internals/runner.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,25 @@ def _check_conda_env_bin_dir(conda_env_bin_dir):
180180

181181
def _infer_khiops_installation_method(trace=False):
182182
"""Return the Khiops installation method"""
183-
# We are in a conda environment if
184-
# - if the CONDA_PREFIX environment variable exists and,
185-
# - if MODL, MODL_Coclustering and mpiexec files exists in
186-
# `$CONDA_PREFIX/bin`
187-
#
188-
# Note: The check that MODL and MODL_Coclustering are actually executable is done
183+
# We are in a Conda environment if
184+
# - the CONDA_PREFIX environment variable exists and,
185+
# - the khiops_env script exists within:
186+
# - `%CONDA_PREFIX\Library\bin%` on Windows
187+
# - `$CONDA_PREFIX/bin` on Linux and MacOS
188+
# Note: The check that the Khiops binaries are actually executable is done
189189
# afterwards by the initializations method.
190-
# We are in a conda env if the Khiops binaries exists within `$CONDA_PREFIX/bin`
191-
if "CONDA_PREFIX" in os.environ and _khiops_env_file_exists(
192-
os.path.join(os.environ["CONDA_PREFIX"], "bin")
193-
):
194-
installation_method = "conda"
195-
# Otherwise, we choose between conda-based and local (default choice)
196-
else:
190+
installation_method = "unknown"
191+
if "CONDA_PREFIX" in os.environ:
192+
conda_env_dir = os.environ["CONDA_PREFIX"]
193+
if platform.system() == "Windows":
194+
conda_binary_dir = os.path.join(conda_env_dir, "Library", "bin")
195+
else:
196+
conda_binary_dir = os.path.join(conda_env_dir, "bin")
197+
if _khiops_env_file_exists(conda_binary_dir):
198+
installation_method = "conda"
199+
# Otherwise (installation_method is still "unknown"), we choose between
200+
# conda-based and local (default choice)
201+
if installation_method == "unknown":
197202
env_bin_dir = _infer_env_bin_dir_for_conda_based_installations()
198203
if trace:
199204
print(f"Environment binary dir: '{env_bin_dir}'")

0 commit comments

Comments
 (0)