首页 > 解决方案 > Yocto:无法在 yocto 构建系统上构建 scikit-learn

问题描述

我使用 yocto (warrior) 安装了 numpy 和 scipy,但是当我添加 scikit-learn 配方时,它无法找到 numpy 配方。

食谱如下所示:

SUMMARY = "A set of python modules for machine learning and data mining"
HOMEPAGE = "http://scikit-learn.org"
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
#   COPYING
LICENSE = "new-BSD"
LIC_FILES_CHKSUM = "file://COPYING;md5=5f6fa516b7dec5faf1c6031236caebce"

SRC_URI = "https://files.pythonhosted.org/packages/18/28/5a48b00599b476875415b97bdfdb3849bafb31183c1d785501dbc8a77aa2/scikit-learn-${PV}.tar.gz"
SRC_URI[md5sum] = "dab189dd5556ae59f7a1efce9c86c002"
SRC_URI[sha256sum] = "51ee25330fc244107588545c70e2f3570cfc4017cff09eed69d6e1d82a212b7d"

S = "${WORKDIR}/scikit-learn-${PV}"

inherit setuptools3

# WARNING: the following rdepends are determined through basic analysis of the
# python sources, and might not be 100% accurate.
RDEPENDS_${PN} += "python3-compression python3-core python3-crypt python3-difflib python3-distutils python3-io python3-json python3-logging python3-math python3-misc python3-numbers python3-pickle python3-pkgutil python3-pprint python3-shell python3-threading python3-unittest python3-numpy"

日志数据如下:

DEBUG: Executing python function externalsrc_compile_prefunc
NOTE: python3-scikit-learn: compiling from external source tree /home/test/build/workspace/sources/python3-scikit-learn
DEBUG: Python function externalsrc_compile_prefunc finished
DEBUG: Executing shell function do_compile
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "setup.py", line 195, in check_package_status
module = importlib.import_module(package)
File "/home/test/build/tmp/work/armv7vet2-neon-phytec-linux-gnueabi/python3-scikit-learn/0.22.1-r0/recipe-sysroot-native/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'numpy'
Traceback (most recent call last):
File "setup.py", line 303, in <module>
setup_package()
File "setup.py", line 291, in setup_package
check_package_status('numpy', NUMPY_MIN_VERSION)
File "setup.py", line 221, in check_package_status
.format(package, req_str, instructions))
ImportError: numpy is not installed.
scikit-learn requires numpy >= 1.11.0.
Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html
ERROR: 'python3 setup.py build ' execution failed.

标签: pythonscikit-learnyocto

解决方案


我为 scikit-learn 版本 0.20.4 创建了一个配方,但我使用了 pypi 并且依赖项配置为:

PYPI_PACKAGE = "scikit-learn"

DEPENDS = "${PYTHON_PN}-numpy-native ${PYTHON_PN}-numpy ${PYTHON_PN}-scipy ${PYTHON_PN}-joblib ${PYTHON_PN}-core"

RDEPENDS_${PN} += "${PYTHON_PN}-numpy ${PYTHON_PN}-scipy"


inherit pypi
inherit setuptools3
inherit distutils3
inherit pkgconfig

在这种情况下,我的食谱被命名为python3-scikit-learn_0.20.4.bb.


推荐阅读