From a7f77ccba688cd66e143f9143401d150ffb4e5bb Mon Sep 17 00:00:00 2001 From: Thierry RAMORASOAVINA Date: Tue, 9 Dec 2025 16:58:56 +0100 Subject: [PATCH 1/3] Add the detection of a python virtual environment when searching for unhappy installation paths under Windows - python sys.base_prefix differs from sys.prefix in conda-based installation or pip installation within a virtual env --- khiops/core/internals/runner.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/khiops/core/internals/runner.py b/khiops/core/internals/runner.py index ed4df15f..32026101 100644 --- a/khiops/core/internals/runner.py +++ b/khiops/core/internals/runner.py @@ -1218,9 +1218,15 @@ def _detect_library_installation_incompatibilities(self, library_root_dir): if ( platform.system() == "Windows" and - # Under Windows, python is not in a bin/ folder - # for conda-based installations - str(Path(sys.executable).parents[0]) != base_dir + # Under Windows, there are two cases : + ( + # for conda-based installations python is inside 'base_dir' + str(Path(sys.executable).parents[0]) != base_dir + and + # for 'binary+pip' installations (within a virtual env) + # python is inside 'base_dir'/Scripts + str(Path(sys.executable).parents[1]) != base_dir + ) # Under Linux or MacOS a bin/ folder exists or str(Path(sys.executable).parents[1]) != base_dir ): From 99b832a6d626959d87c350436b32b61acbafcef4 Mon Sep 17 00:00:00 2001 From: Thierry RAMORASOAVINA Date: Wed, 10 Dec 2025 16:30:48 +0100 Subject: [PATCH 2/3] Update the integration test for windows --- .github/workflows/tests.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6cbbea11..1ad57de4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -276,9 +276,21 @@ jobs: python -m pip install setuptools python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" -s "\n" > requires.txt - # Install the Python requirements + # Install the Python requirements outside a python venv Get-Content .\requires.txt ` | ForEach-Object {python -m pip install $_.toString()} + + # Create and activate a python venv + python -m venv khiops-windows-venv + khiops-windows-venv\Scripts\Activate.ps1 + + # Install the Python requirements inside a venv + # The venv python executable is used here + Get-Content .\requires.txt ` + | ForEach-Object {khiops-windows-venv\Scripts\python -m pip install $_.toString()} + + # Deactivate the python venv + deactivate Remove-Item -force requires.txt - name: Setup and Install Test Requirements run: python -m pip install -r test-requirements.txt @@ -323,6 +335,22 @@ jobs: # Execute Khiops Coclustering sample (train and deploy model) Invoke-Expression -Command "$Python -m khiops.samples.samples -i deploy_coclustering -e" + + # Install khiops-python in the python venv using the sources + # The venv python executable is used here + Invoke-Expression -Command "khiops-windows-venv\Scripts\python -m pip install ." + # Change directory to avoid using the cloned khiops-python + Invoke-Expression -Command "cd khiops-windows-venv\" + + # Print status + # The venv python executable is used here + Invoke-Expression -Command "Scripts\python -c 'import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)'" + + # The installation status MUST not fail + if ($LASTEXITCODE -ne 0) { + Write-Host "::error::Status error: khiops-python installation status check MUST NOT fail" + exit 1 + } check-khiops-integration-on-linux: strategy: fail-fast: false From c240e9926746020cdcdda5e895b05b10b51b1836 Mon Sep 17 00:00:00 2001 From: Thierry RAMORASOAVINA Date: Wed, 10 Dec 2025 16:55:25 +0100 Subject: [PATCH 3/3] Set a max version for scikit-learn to avoid undesired breaking changes --- doc/requirements.txt | 2 +- pyproject.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 59e27af2..656100f0 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,5 +5,5 @@ nbconvert==6.4.4 nbformat==5.3.0 numpydoc>=1.5.0 pandas>=0.25.3 -scikit-learn>=0.22.2 +scikit-learn>=0.22.2,<=1.7.2 sphinx-copybutton>=0.5.0 diff --git a/pyproject.toml b/pyproject.toml index 3620abb5..e7d27170 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,7 +105,8 @@ classifiers = [ requires-python = ">=3.8" dependencies = [ "pandas>=0.25.3", - "scikit-learn>=0.22.2", + # do not use the latest version, to avoid undesired breaking changes + "scikit-learn>=0.22.2,<=1.7.2", ] [project.urls] @@ -113,8 +114,7 @@ Homepage = "https://khiops.org" [project.optional-dependencies] s3 = [ - # do not necessarily use the latest version, to avoid undesired breaking - # changes + # do not use the latest version, to avoid undesired breaking changes "boto3>=1.17.39,<=1.35.69", ] gcs = [