ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

There is an issue with NumPy binary compatibility that cropped up recently and has been incredibly difficult to debug. I have tried numerous solutions from ValueError: numpy.ndarray size changed when calling import hdbscan · Issue #457 · scikit-learn-contrib/hdbscan · GitHub. Supposedly, bumping up to numpy==1.22.0 should fix it, but I can’t do that due to a numba requirement. As I mentioned towards the end of #475 (linked previously), I’ve been able to get it to work on my local Windows computer, but not on GitHub actions ubuntu-latest for Python 3.8 or Python 3.9.

See one of the workflows at the following location:

See the following error:

mat_discover/tests/test_mat_discover.py:16: in <module>
    from mat_discover.mat_discover_ import Discover
mat_discover/mat_discover_.py:31: in <module>
    import hdbscan
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/hdbscan/__init__.py:1: in <module>
    from .hdbscan_ import HDBSCAN, hdbscan
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/hdbscan/hdbscan_.py:21: in <module>
    from ._hdbscan_linkage import (single_linkage,
hdbscan/_hdbscan_linkage.pyx:1: in init hdbscan._hdbscan_linkage
    ???
E   ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
_____ ERROR collecting mat_discover/tests/test_suggest_next_experiment.py ______
mat_discover/tests/test_suggest_next_experiment.py:7: in <module>
    from mat_discover.adaptive_design import Adapt
mat_discover/adaptive_design.py:6: in <module>
    from mat_discover.mat_discover_ import Discover, my_mvn
mat_discover/mat_discover_.py:31: in <module>
    import hdbscan
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/hdbscan/__init__.py:1: in <module>
    from .hdbscan_ import HDBSCAN, hdbscan
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/hdbscan/hdbscan_.py:21: in <module>
    from ._hdbscan_linkage import (single_linkage,
hdbscan/_hdbscan_linkage.pyx:1: in init hdbscan._hdbscan_linkage
    ???
E   ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
1 Like

Hello,
I have the same error with jakteristics, numpy 1.20.3 and numba 0.54.1 on Ubuntu latest, python 3.9 - have you found a fix for this?

I have also tried ubuntu 18.0.4 with no success. I am thinking of switching to GitHub container registry as I am able to build and run successfully with Docker on Debian but I would prefer to get things working on vanilla GH Actions.