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

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

我正在尝试让 numpy<1.19.0ConfigSpace==0.4.16python==3.7 conda 环境中工作。 numpy 的安装版本是 1.18.5.

我收到以下错误:

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

我尝试了其他类似问题中建议的解决方案,例如尝试其他版本的 numpy 或删除所有 numpy 安装并使用 [= 重新安装 numpyConfigSpace 20=] 选项 --no-cache-dir --no-binary,但错误仍然存​​在。

还有其他我可以尝试的潜在解决方案吗?

通过咨询 this GitHub issue page,我对这个问题有了一些额外的了解。事实证明,如果 PyObject 的大小小于 C header 的大小,则必须升级错误引用的包(此处 numpy)才能解决错误,并且反之亦然。

我可以通过将 numpy 升级到版本 1.20.0 来解决问题,即使要求是 numpy<1.19.0

分享这个以防对其他人有帮助:我试图让 fairseq to work and ran into the same issue of ValueError with binary incompatibility as possible reason and Jake's 将 numpy 更新为 1.20.0 帮助解决了问题,即使是针对 numpy<1.19.0 的特别要求。

我 运行 遇到了同样的问题:ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject 这个解决方案对我有用。具体使用Dockerfile创建镜像,我安装flair==0.8.0.post1,需要numpy<1.19.0。但是在安装 flair==0.8.0.post1 之后我安装了 numpy==1.20.0 并且这避免了这个问题。 Dockerfile 的这一部分是:

RUN pip install flair==0.8.0.post1
RUN pip install numpy==1.20.0