|
13 | 13 |
|
14 | 14 | from . import Extension
|
15 | 15 |
|
| 16 | +SKLEARN_HINT = ( |
| 17 | + "But it looks related to scikit-learn. " |
| 18 | + "Please install the OpenML scikit-learn extension (openml-sklearn) and try again. " |
| 19 | + "For more information, see " |
| 20 | + "https://github.com/openml/openml-sklearn?tab=readme-ov-file#installation" |
| 21 | +) |
| 22 | + |
16 | 23 |
|
17 | 24 | def register_extension(extension: type[Extension]) -> None:
|
18 | 25 | """Register an extension.
|
@@ -57,7 +64,13 @@ def get_extension_by_flow(
|
57 | 64 | candidates.append(extension_class())
|
58 | 65 | if len(candidates) == 0:
|
59 | 66 | if raise_if_no_extension:
|
60 |
| - raise ValueError(f"No extension registered which can handle flow: {flow}") |
| 67 | + install_instruction = "" |
| 68 | + if flow.name.startswith("sklearn"): |
| 69 | + install_instruction = SKLEARN_HINT |
| 70 | + raise ValueError( |
| 71 | + f"No extension registered which can handle flow: {flow.flow_id} ({flow.name}). " |
| 72 | + f"{install_instruction}" |
| 73 | + ) |
61 | 74 |
|
62 | 75 | return None
|
63 | 76 |
|
@@ -96,7 +109,12 @@ def get_extension_by_model(
|
96 | 109 | candidates.append(extension_class())
|
97 | 110 | if len(candidates) == 0:
|
98 | 111 | if raise_if_no_extension:
|
99 |
| - raise ValueError(f"No extension registered which can handle model: {model}") |
| 112 | + install_instruction = "" |
| 113 | + if type(model).__module__.startswith("sklearn"): |
| 114 | + install_instruction = SKLEARN_HINT |
| 115 | + raise ValueError( |
| 116 | + f"No extension registered which can handle model: {model}. {install_instruction}" |
| 117 | + ) |
100 | 118 |
|
101 | 119 | return None
|
102 | 120 |
|
|
0 commit comments