pythonpython-3.xpipruntime-errorcompatibility

ValueError: numpy.ndarray size changed, may indicate binary incompatibility


I am trying to get numpy<1.19.0 and ConfigSpace==0.4.16 to work in a python==3.7 conda environment. The installed version of numpy is 1.18.5.

I am getting the following error:

Traceback (most recent call last):
  File "/home/user/.conda/envs/deephyper/bin/deephyper", line 5, in <module>
    from deephyper.core.cli import main
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/core/cli/__init__.py", line 1, in <module>
    from deephyper.core.cli.cli import main
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/core/cli/cli.py", line 9, in <module>
    from deephyper.core.cli import hps, nas, balsam_submit
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/core/cli/hps.py", line 6, in <module>
    from deephyper.search.util import load_attr_from
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/search/__init__.py", line 6, in <module>
    from deephyper.search.search import Search
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/search/search.py", line 8, in <module>
    from deephyper.evaluator.evaluate import Evaluator
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/evaluator/__init__.py", line 5, in <module>
    from deephyper.evaluator.evaluate import Encoder
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/deephyper/evaluator/evaluate.py", line 15, in <module>
    import skopt
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/__init__.py", line 45, in <module>
    from . import callbacks
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/callbacks.py", line 17, in <module>
    from skopt.utils import dump
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/utils.py", line 19, in <module>
    from .sampler import Sobol, Lhs, Hammersly, Halton, Grid
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/sampler/__init__.py", line 4, in <module>
    from .lhs import Lhs
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/sampler/lhs.py", line 9, in <module>
    from ..space import Space, Categorical
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/space/__init__.py", line 5, in <module>
    from .space import *
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/skopt/space/space.py", line 27, in <module>
    import ConfigSpace as CS
  File "/home/user/.conda/envs/deephyper/lib/python3.7/site-packages/ConfigSpace/__init__.py", line 37, in <module>
    from ConfigSpace.configuration_space import Configuration, \
  File "ConfigSpace/configuration_space.pyx", line 39, in init ConfigSpace.configuration_space
  File "ConfigSpace/hyperparameters.pyx", line 1, in init ConfigSpace.hyperparameters
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

I tried suggested solutions suggested in other similar questions such as trying other versions of numpy or removing all numpy installations and reinstalling numpy and ConfigSpace with pip options --no-cache-dir --no-binary, but the error persists.

Are there other potential solutions that I could try?


Solution

  • I got some additional insight into the issue by consulting this GitHub issue page. As it turns out, if the size from the PyObject is smaller than the size from the C header, an upgrade of the package referenced by the error (here numpy) is necessary to resolve the error, and vice versa.

    I was able to resolve the issue by upgrading numpy to version 1.20.0, even though the requirement was numpy<1.19.0.