I'm attempting to create a recipe for SciKit-Learn
from pypi. But it seems that python3 setup.py build
is unable to find NumPy
, even though i know i have it on the build host (both with pip3 install numpy
and bitbake python3-numpy-native
).
Right now i have the following in my recipe:
DESCRIPTION = "python3-scikit-learn"
SECTION = "devel/python"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://PKG-INFO;md5=4a2bb4f4ec2b68ec46d5d1be3371b2c7"
PR = "r0"
SRCNAME = "scikit-learn"
SRC_URI="https://files.pythonhosted.org/packages/1e/ce/9d8c88e68af0a5b5c5d78d8d2b7bcadfd45e1d6afc863ccb9aee30765b06/scikit-learn-0.21.3.tar.gz"
SRC_URI[md5sum] = "d7bb030fea8d503d897a0dc8c50b9241"
SRC_URI[sha256sum] = "eb9b8ebf59eddd8b96366428238ab27d05a19e89c5516ce294abc35cea75d003"
S = "${WORKDIR}/${SRCNAME}-${PV}"
inherit setuptools3
This kind of recipe works for other python packages that aren't in openembedded yet, like joblib
which i did get to install with this exact method.
I can see when i run bitbake python3-scikit-learn -c devshell
and running python3 there, i am unable to import numpy as it is missing from the path that the devshell python3 is looking (which is in /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/
)
I've tried copy-paste the build host numpy package folder manually to this directory but then this error occours:
Log data follows:
| DEBUG: Executing shell function do_compile
| C compiler: aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot -Wno-unused-result -Wsign-compare -DNDEBUG -g -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -fPIC
|
| compile options: '-c'
| extra options: '-fopenmp'
| aarch64-poky-linux-gcc: test_openmp.c
| aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now objects/test_openmp.o -o test_openmp -fopenmp
| Partial import of sklearn during the build process.
| /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls'
| warnings.warn(msg)
| /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires'
| warnings.warn(msg)
| /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
| warnings.warn(msg)
| Traceback (most recent call last):
| File "setup.py", line 291, in <module>
| setup_package()
| File "setup.py", line 287, in setup_package
| setup(**metadata)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/core.py", line 137, in setup
| config = configuration()
| File "setup.py", line 174, in configuration
| config.add_subpackage('sklearn')
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/misc_util.py", line 1035, in add_subpackage
| caller_level = 2)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/misc_util.py", line 1004, in get_subpackage
| caller_level = caller_level + 1)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
| config = setup_module.configuration(*args)
| File "sklearn/setup.py", line 76, in configuration
| maybe_cythonize_extensions(top_path, config)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/scikit-learn-0.21.3/sklearn/_build_utils/__init__.py", line 42, in maybe_cythonize_extensions
| with_openmp = check_openmp_support()
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/scikit-learn-0.21.3/sklearn/_build_utils/openmp_helpers.py", line 100, in check_openmp_support
| output = subprocess.check_output('./test_openmp')
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 395, in check_output
| **kwargs).stdout
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 472, in run
| with Popen(*popenargs, **kwargs) as process:
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 775, in __init__
| restore_signals, start_new_session)
| File "/home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/recipe-sysroot-native/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
| raise child_exception_type(errno_num, err_msg, err_filename)
| OSError: [Errno 8] Exec format error: './test_openmp'
| ERROR: 'python3 setup.py build ' execution failed.
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/yoctouser/build/tmp/work/aarch64-poky-linux/python3-scikit-learn/0.21.3-r0/temp/log.do_compile.605)
Anyone have an idea on how to fix this?