Skip to content

Commit 0f3c9ff

Browse files
betatimlesteve
andauthored
Require a minimum scipy version for array API support (scikit-learn#29552)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
1 parent ea6c77b commit 0f3c9ff

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

sklearn/utils/_array_api.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from functools import wraps
1111

1212
import numpy
13+
import scipy
1314
import scipy.special as special
1415

1516
from .._config import get_config
@@ -105,9 +106,20 @@ def _check_array_api_dispatch(array_api_dispatch):
105106
min_numpy_version = "1.21"
106107
if numpy_version < parse_version(min_numpy_version):
107108
raise ImportError(
108-
f"NumPy must be {min_numpy_version} or newer to dispatch array using"
109-
" the API specification"
109+
f"NumPy must be {min_numpy_version} or newer (found"
110+
f" {numpy.__version__}) to dispatch array using"
111+
" the array API specification"
110112
)
113+
114+
scipy_version = parse_version(scipy.__version__)
115+
min_scipy_version = "1.14.0"
116+
if scipy_version < parse_version(min_scipy_version):
117+
raise ImportError(
118+
f"SciPy must be {min_scipy_version} or newer"
119+
" (found {scipy.__version__}) to dispatch array using"
120+
" the array API specification"
121+
)
122+
111123
if os.environ.get("SCIPY_ARRAY_API") != "1":
112124
warnings.warn(
113125
(

0 commit comments

Comments
 (0)