I am getting this on a Raspberry Pi zero after having used it no problem for months, I just turned it on again after a few months and now I can't import pandas:
Python 3.7.3 (default, Oct 31 2022, 14:04:00)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.7/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import (
File "/home/pi/.local/lib/python3.7/site-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/home/pi/.local/lib/python3.7/site-packages/pandas/compat/numpy/__init__.py", line 7, in <module>
from pandas.util.version import Version
File "/home/pi/.local/lib/python3.7/site-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "/home/pi/.local/lib/python3.7/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "/home/pi/.local/lib/python3.7/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.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject
This error is very similar to the one in this question, but slightly different.
I tried updating my system:
sudo apt update
And I tried uninstalling and re-installing numpy and pandas:
sudo apt remove python3-numpy python3-pandas
sudo apt-get install python3-numpy python3-pandas python3-scipy python3-sklearn python3-numexpr
but it does not fix it.
Any ideas?
Version info
python3-numpy/oldstable,now 1:1.16.2-1 armhf [installed]
python3-pandas-lib/oldstable,now 0.23.3+dfsg-3 armhf [installed,automatic]
python3-pandas/oldstable,now 0.23.3+dfsg-3 all [installed]
System info
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"