-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Issue
We currently pin NumPy to < 2.2 for Python 3.14 due to a compatibility bug in NumPy 2.2.x that causes ValueError: operands could not be broadcast together with shapes in scikit-image's histogram/bincount functions.
Error Details
ValueError: operands could not be broadcast together with shapes (256,) (258,) (256,)
File "skimage/filters/thresholding.py", line 390, in threshold_otsu
counts, bin_centers = _validate_image_histogram(image, hist, nbins)
File "skimage/exposure/exposure.py", line 274, in histogram
hist, bin_centers = _histogram(image, nbins, source_range, normalize)
File "numpy/lib/_histograms_impl.py", line 876, in histogram
n += np.bincount(indices, weights=tmp_w, minlength=n_equal_bins).astype(ntype)Current Workaround
In pyproject.toml:
"numpy>=1.26.4,<2.2; python_version>='3.14'",
"numpy>=1.26.4; python_version<'3.14'",Action Items
- Monitor NumPy releases for fix (check NumPy 2.2.1+)
- Monitor scikit-image releases for workaround
- Test with newer NumPy versions when available
- Remove version constraint once bug is fixed
- Update CI to test with latest NumPy
References
- First observed in CI: PR Fix Windows virtual workspace path separator issue #33
- Affects: Python 3.14 only
- Workaround implemented: commit 00b9a4e
How to Test
Once a fix is available:
# Remove the version pin from pyproject.toml
# Then test:
python3.14 -m pytest tests/integration/test_main.py \
--it-backends disk \
--it-microscopes ImageXpress \
-vIf tests pass, the pin can be removed.
Reactions are currently unavailable