pydantic-core
pydantic-core copied to clipboard
No Module pydantic_core._pydantic_core (armv7l, built from source)
I am getting File "/usr/lib/python3.10/site-packages/pydantic_core/init.py", line 6, in
I am building pydantic_core 2.14.6 using maturin 1.4.0, rust 1.7.0 for armv7l using the Yocto Project. No errors while building. The compiled binary is named pydantic_core.cpython-310-armv7l-linux-gnueabihf.so. The file output looks correct (ELF 32bit LSB shared object, ARM, EABI5 version 1(SYSV), dynamically linked). Additionally, I can load it manually using the following python code.
import importlib.util
import sys
path_to_so = '/usr/lib/python3.10/site-packages/_pydantic_core.cpython-310-armv7l-linux-gnueabihf.so'
spec = importlib.util.spec_from_file_location("pydantic_core._pydantic_core", path_to_so)
module = importlib.util.module_from_spec(spec)
sys.modules["pydantic_core._pydantic_core"] = module
spec.loader.exec_module(module)
I was able to successfully build and import pydantic_core for x86_64 but not for armv7l. I assume it is some issue with python not being able to automatically load the file since loading it manually using the above code works fine. Unfortunately, I do not know enough to diagnose any further so any help would be greatly appreciated!
Please let me know if there is any other info you need. Thanks!
Thanks for the report. What do you get for "EXT_SUFFIX" config variable? For example, I get:
$ python -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))'
.cpython-312-x86_64-linux-gnu.so
Running that snippet gives out ".cpython-310-arm-linux-gnueabi.so" which is not what is in the site-packages folder. After renaming the library file, everything works!
I assume this is not really a pydantic_core issue and is more of a Yocto Project / build issue. However, if this is not the case, please let me know if there is anything else you need from me.
cc @messense is this possibly a maturin issue picking the wrong EXT_SUFFIX?
Hard to say without more information on how does Yocto Project build the wheel, it's very likely that it has provided a wrong sysconfig file.
Closing this as stale for now, feel free to ping us if you're still having issues!