Skip to content

Commit 6e5bcb1

Browse files
authored
Merge pull request #514 from KhiopsML/fix-unhappy-paths-detection-windows
Add the detection of a python virtual environment when searching for unhappy installation paths under Windows
2 parents 0cd680a + c240e99 commit 6e5bcb1

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,21 @@ jobs:
276276
python -m pip install setuptools
277277
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" -s "\n" > requires.txt
278278
279-
# Install the Python requirements
279+
# Install the Python requirements outside a python venv
280280
Get-Content .\requires.txt `
281281
| ForEach-Object {python -m pip install $_.toString()}
282+
283+
# Create and activate a python venv
284+
python -m venv khiops-windows-venv
285+
khiops-windows-venv\Scripts\Activate.ps1
286+
287+
# Install the Python requirements inside a venv
288+
# The venv python executable is used here
289+
Get-Content .\requires.txt `
290+
| ForEach-Object {khiops-windows-venv\Scripts\python -m pip install $_.toString()}
291+
292+
# Deactivate the python venv
293+
deactivate
282294
Remove-Item -force requires.txt
283295
- name: Setup and Install Test Requirements
284296
run: python -m pip install -r test-requirements.txt
@@ -323,6 +335,22 @@ jobs:
323335
324336
# Execute Khiops Coclustering sample (train and deploy model)
325337
Invoke-Expression -Command "$Python -m khiops.samples.samples -i deploy_coclustering -e"
338+
339+
# Install khiops-python in the python venv using the sources
340+
# The venv python executable is used here
341+
Invoke-Expression -Command "khiops-windows-venv\Scripts\python -m pip install ."
342+
# Change directory to avoid using the cloned khiops-python
343+
Invoke-Expression -Command "cd khiops-windows-venv\"
344+
345+
# Print status
346+
# The venv python executable is used here
347+
Invoke-Expression -Command "Scripts\python -c 'import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)'"
348+
349+
# The installation status MUST not fail
350+
if ($LASTEXITCODE -ne 0) {
351+
Write-Host "::error::Status error: khiops-python installation status check MUST NOT fail"
352+
exit 1
353+
}
326354
check-khiops-integration-on-linux:
327355
strategy:
328356
fail-fast: false

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ nbconvert==6.4.4
55
nbformat==5.3.0
66
numpydoc>=1.5.0
77
pandas>=0.25.3
8-
scikit-learn>=0.22.2
8+
scikit-learn>=0.22.2,<=1.7.2
99
sphinx-copybutton>=0.5.0

khiops/core/internals/runner.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,9 +1218,15 @@ def _detect_library_installation_incompatibilities(self, library_root_dir):
12181218
if (
12191219
platform.system() == "Windows"
12201220
and
1221-
# Under Windows, python is not in a bin/ folder
1222-
# for conda-based installations
1223-
str(Path(sys.executable).parents[0]) != base_dir
1221+
# Under Windows, there are two cases :
1222+
(
1223+
# for conda-based installations python is inside 'base_dir'
1224+
str(Path(sys.executable).parents[0]) != base_dir
1225+
and
1226+
# for 'binary+pip' installations (within a virtual env)
1227+
# python is inside 'base_dir'/Scripts
1228+
str(Path(sys.executable).parents[1]) != base_dir
1229+
)
12241230
# Under Linux or MacOS a bin/ folder exists
12251231
or str(Path(sys.executable).parents[1]) != base_dir
12261232
):

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ classifiers = [
105105
requires-python = ">=3.8"
106106
dependencies = [
107107
"pandas>=0.25.3",
108-
"scikit-learn>=0.22.2",
108+
# do not use the latest version, to avoid undesired breaking changes
109+
"scikit-learn>=0.22.2,<=1.7.2",
109110
]
110111

111112
[project.urls]
112113
Homepage = "https://khiops.org"
113114

114115
[project.optional-dependencies]
115116
s3 = [
116-
# do not necessarily use the latest version, to avoid undesired breaking
117-
# changes
117+
# do not use the latest version, to avoid undesired breaking changes
118118
"boto3>=1.17.39,<=1.35.69",
119119
]
120120
gcs = [

0 commit comments

Comments
 (0)