-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: ValueError: Buffer dtype mismatch, expected 'intp_t' but got 'long long' on ARMv7 32 bit #55305
Comments
Hey all! any feedback will be appreciated. |
Hi scinteeb, When installing 64bit it works fine. When using 32bit it fails. OS details:
Installed Versions
Reproducible Example
Expected Behavior
I will try to dive further into this issue ... and let you know about any news... |
My target device is an embedded unit with scarce storage resources. That's why I cannot do much testing on it.
|
hello Bogdan, My records are as follows: 1.errors: 2.INSTALLED VERSIONS 3.Cross compiler = arm-linux-gnueabihf-gcc 4.Example of target library files for partial cross compilation,name as : |
Hi Bogdan,
The test was successful:
Installed Versions:
So it seems Yocto kirkstone might compile numpy, pandas, ... not properly for 32bit... By the way I have backported down to gatesgarth where I did not fiind working setup either numpy and pandas are not compatible or 32bit error occurs. That means we might need to find out the magic setting (options) for cross compiling numpy, pands... @avan051 it seems your cross compiler or options on Ubuntu (32bit) are also missing some magic settings |
@mweitner |
There are two more tests that we can do to narrow down further the issue. I am planning to run them tomorrow or a day after tomorrow after I'll build a qemu image.
We might see that only module compiled by Yocto is causing the problem so we'll focus on that one. |
Hi Bogdan,
pandas==1.4.2 installed by pip3 on target
Verification:
|
I will dive further into how Yocto build compiles python3-pandas package and what is the difference between on-target pip build and Yocto cross compile build? So far I identified Options missing on Yocto build:
However adding those to TOOLCHAIN_OPTIONS in order to have them at cross compiler CC did not help. Is there anyone who knows pip build process of pandas to identify the missing/wrong option, parameter, libary link, etc? |
While I am building the qemu image, I kept looking at the source code. I believe that the the issue is coming from the mismatch definition of the intp_t type in pandas, numpy AND cython, definitely caused by some compiling parameter in Yocto. I guess that in one (or more) recipe the architecture is not properly detected using 64-bit platform instead of 32-bit. |
Hi Bogdan, just stumbled over issue labels ... it could make sense we tag this issue with following labels:
This might help to get more visible with our issue |
by the way I am a bit worried for the future supporting arm 32bit target using pandas or even Data science python3 eco system as there seems to be a lot going on decreasing project effort by removing 32bit support in future see open issue: |
Back to technical issue.. I might have found a track while forced rebuilding of pandas by pip I see there might be no wheel support for arm 32 bit "anymore" ... as it downloads tar with egg-info. If you follow Issue #44453 discussion it mentions that numpy project has dropped 32bit wheel support... Yocto build of our numpy version has wheel support but 64 bit tag:
It looks like when pip install pandas on target it compiles it dependency numpy again with 32bit arm support... pandas installed on-target by pip:
Forced pip reinstall pending:
Interesting is on a forced-reinstall I get build error on target telling me can not build with --no-use-pep517 option as using meson build backend... When building without --no-use-pep517 option it build successfully. In addition, it creates a numpy wheel file for numpy==1.22.6 for arm 32 bit. That proofs the guess above is right, the pip install pandas on target builds wheel file for latest supporting numpy==1.21.6 compiled for arm 32bit:
SolutionSolution of our problem should be to adapt all relevant python3 packages recipes of Yocto to build arm 32 bit wheel files. Another example when Yocto builds and installs Cython (python3-cython) compared to on target pip install:
|
If you agree with my analysis, I am going to dive into fixing yocto recipes and hopefully coming up with patches and/or upstream pull request... Anyway I keep you informed... |
Yes, definitely the solution is to adapt the Yocto recipes to compile the right version of these packages. And yes, I am willing to support the effort. |
When cross-compiled for arm 32-bit under Yocto, the WHEELs that are claimed to be compiled for X86_64 contain in fact the libraries with the correct signature "ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked".
|
The item #1 can easily be addressed if we create a bbappend file with the content: |
yes also just did same with SETUPTOOLS_BUILD_ARGS set to
which works nicely .. So think we got the solution for #1 great thx for your help So you think patching setuptool3.bbclass could be right fix for it ... Next is #2 The pandas problem, the mismatch of intp_t type between modules which I will check next week on raspberrypi |
From my perspective, having the setuptool3.bbclass patched is the right approach. However, I cannot say that I can see all use cases / implications of this so it could be that the maintainer will disagree. I'll try to get in contact with them. |
Hi Bogdan, I think the content of wheel file is not right meaning compiled numpy and pandas especially its C extensions... Unfortunately I do not have a lot of time rest of the week... what I started with is building numpy and pandas in context of Yocto extSDK trying to find the right build options for numpy and pandas ... and verify on my raspi 32bit ... |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The simplest test on a dataframe object is failing on an embedded 32bit device with ARMv7 CPU. No matter how the dataframe is created, from an array or read from a csv file using read_csv, access on the object fails the same:
File "pandas/_libs/internals.pyx", line 711, in pandas._libs.internals.BlockManager._rebuild_blknos_and_blklocs
ValueError: Buffer dtype mismatch, expected 'intp_t' but got 'long long'
Unfortunately, on that platform I cannot compile a newer version of pandas, so I cannot verify if the issue is present in the latest version or main branch.
Expected Behavior
The expected output is:
Name Age
0 Alice 25
1 Bob 30
2 Carol 35
but running the script is giving:
File "/home/root/test.py", line 10, in
print(df)
File "/usr/lib/python3.10/site-packages/pandas/core/frame.py", line 1011, in repr
return self.to_string(**repr_params)
File "/usr/lib/python3.10/site-packages/pandas/core/frame.py", line 1192, in to_string
return fmt.DataFrameRenderer(formatter).to_string(
File "/usr/lib/python3.10/site-packages/pandas/io/formats/format.py", line 1128, in to_string
string = string_formatter.to_string()
File "/usr/lib/python3.10/site-packages/pandas/io/formats/string.py", line 25, in to_string
text = self._get_string_representation()
File "/usr/lib/python3.10/site-packages/pandas/io/formats/string.py", line 40, in _get_string_representation
strcols = self._get_strcols()
File "/usr/lib/python3.10/site-packages/pandas/io/formats/string.py", line 31, in _get_strcols
strcols = self.fmt.get_strcols()
File "/usr/lib/python3.10/site-packages/pandas/io/formats/format.py", line 611, in get_strcols
strcols = self._get_strcols_without_index()
File "/usr/lib/python3.10/site-packages/pandas/io/formats/format.py", line 864, in _get_strcols_without_index
str_columns = self._get_formatted_column_labels(self.tr_frame)
File "/usr/lib/python3.10/site-packages/pandas/io/formats/format.py", line 943, in _get_formatted_column_labels
dtypes = self.frame.dtypes
File "/usr/lib/python3.10/site-packages/pandas/core/generic.py", line 5746, in dtypes
data = self._mgr.get_dtypes()
File "/usr/lib/python3.10/site-packages/pandas/core/internals/managers.py", line 228, in get_dtypes
return dtypes.take(self.blknos)
File "/usr/lib/python3.10/site-packages/pandas/core/internals/managers.py", line 168, in blknos
self._rebuild_blknos_and_blklocs()
File "pandas/_libs/internals.pyx", line 711, in pandas._libs.internals.BlockManager._rebuild_blknos_and_blklocs
ValueError: Buffer dtype mismatch, expected 'intp_t' but got 'long long'
Installed Versions
commit : 4bfe3d0
python : 3.10.4.final.0
python-bits : 32
OS : Linux
OS-release : 5.15.32-yoctoEMB+gddbcf3882cd3
Version : #1 SMP PREEMPT Thu Apr 13 04:27:17 UTC 2023
machine : armv7l
processor : armv7l
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.4.2
numpy : 1.22.3
pytz : 2022.1
dateutil : 2.8.2
pip : 22.0.3
setuptools : 59.5.0
Cython : 0.29.28
pytest : 7.1.1
The text was updated successfully, but these errors were encountered: