Wie man numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject behebt
Problem
Beim Ausführen Ihrer Python-Anwendung sehen Sie die folgende Ausnahme:
error_trace.txt
Traceback (most recent call last):
File "/app/run.py", line 2, in <module>
from S3IO import *
File "/app/data.py", line 2, in <module>
import pandas as pd
File "/usr/local/lib/python3.11/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/compat/__init__.py", line 18, in <module>
from pandas.compat.numpy import (
File "/usr/local/lib/python3.11/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
from pandas.util.version import Version
File "/usr/local/lib/python3.11/site-packages/pandas/util/__init__.py", line 2, in <module>
from pandas.util._decorators import ( # noqa:F401
File "/usr/local/lib/python3.11/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly
File "/usr/local/lib/python3.11/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObjectLösung
Sie verwenden eine NumPy-Version, die nicht mit der von Ihnen verwendeten pandas-Version kompatibel ist. Um dies zu beheben, müssen Sie numpy auf eine Version herabstufen, die mit Ihrer pandas-Version kompatibel ist.
downgrade_numpy.sh
pip install numpy==1.26.4wird das Problem meistens beheben. Wenn das nicht funktioniert, versuchen Sie, eine ältere pandas-Version oder eine neuere Python-Version zusammen mit aktuellen Versionen von NumPy und pandas zu verwenden.
Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow