Closed
Description
Describe the bug
Recent Azure CI failure for MNE-Python shows a NumPy 2.0 incompatibility with sklearn, both installed via
python -m pip install --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" "scipy>=1.12.0.dev0" scikit-learn matplotlib
Steps/Code to Reproduce
Not on Windows at the moment so can't make a MWE (can if it's not obvious from the traceback!) but this is what's failing on CIs:
pytest mne/decoding/tests/test_search_light.py -k test_search_light
Expected Results
No error
Actual Results
______________________________ test_search_light ______________________________
mne\decoding\search_light.py:101: in fit
estimators = parallel(
mne\decoding\search_light.py:102: in <genexpr>
p_func(self.base_estimator, split, y, pb.subset(pb_idx), **fit_params)
mne\decoding\search_light.py:358: in _sl_fit
est.fit(X[..., ii], y, **fit_params)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\base.py:1215: in wrapper
return fit_method(estimator, *args, **kwargs)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\ensemble\_bagging.py:343: in fit
return self._fit(X, y, self.max_samples, sample_weight=sample_weight)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\ensemble\_bagging.py:478: in _fit
all_results = Parallel(
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\utils\parallel.py:67: in __call__
return super().__call__(iterable_with_config)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\joblib\parallel.py:1900: in __call__
return output if self.return_generator else list(output)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\joblib\parallel.py:1829: in _get_sequential_output
res = func(*args, **kwargs)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\utils\parallel.py:129: in __call__
return self.function(*args, **kwargs)
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\ensemble\_bagging.py:120: in _parallel_build_estimators
features, indices = _generate_bagging_indices(
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\ensemble\_bagging.py:65: in _generate_bagging_indices
feature_indices = _generate_indices(
C:\hostedtoolcache\windows\Python\3.11.6\x64\Lib\site-packages\sklearn\ensemble\_bagging.py:44: in _generate_indices
indices = sample_without_replacement(
sklearn\\utils\\_random.pyx:216: in sklearn.utils._random.sample_without_replacement
???
sklearn\\utils\\_random.pyx:291: in sklearn.utils._random.sample_without_replacement
???
sklearn\\utils\\_random.pyx:196: in sklearn.utils._random._sample_without_replacement_with_reservoir_sampling
???
E ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long'
Versions
Can't run as it's on CI, but these are the reported versions:
├☑ numpy 2.0.0.dev0+git20231102.439762c (OpenBLAS 0.3.23.dev with 2 threads)
├☑ sklearn 1.4.dev0