scikit-learn 的 Yocto 食谱 [英] Yocto recipe for scikit-learn

查看:105
本文介绍了scikit-learn 的 Yocto 食谱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 scikit-learn 包创建一个 yocto recipe.这取决于 scipy 包.我能够使用以下方法成功构建 scipy 包:https://github.com/gpanders/meta-scipy.

I am trying to create a yocto recipe for scikit-learn package. It depends on scipy pacakge. I was able to successfully build the scipy package using : https://github.com/gpanders/meta-scipy.

当我运行 bitbake python3-scikit-learn 时,出现以下错误:ModuleNotFoundError: 没有名为scipy"的模块

When I run bitbake python3-scikit-learn, i am getting the below error: ModuleNotFoundError: No module named 'scipy'

我正在按以下顺序执行命令.

I am executing the commands in the below order.

一旦我克隆/复制了 scipy 配方和 meta-scipy 中列出的补丁,我就会运行 bitbake python3-scipy并且构建成功.

Once I have cloned/copied the scipy recipes and the patches listed in the meta-scipy, i am running bitbake python3-scipy and the build was successful.

然后,我创建了一个名为python3-scikit-learn_0.23.2.bbrecipe文件,内容如下.

Then, I created a recipe file with the name python3-scikit-learn_0.23.2.bb and the contents are as below.

PYPI_PACKAGE = "scikit-learn"

LICENSE = "BSD"
LIC_FILES_CHKSUM  = "file://PKG-INFO;beginline=8;endline=8;md5=40ee42dc5a49f1617c5c78f16c50e065"

SRC_URI[sha256sum] = "20766f515e6cd6f954554387dfae705d93c7b544ec0e6c6a5d8e006f6f7ef480"

inherit pypi setuptools3

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

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

当我运行 bitbake python3-scikit-learn 时,我收到这个 ModuleNotFoundError: No module named 'scipy'

When I run the bitbake python3-scikit-learn, i am getting this ModuleNotFoundError: No module named 'scipy'

检查devshell python3 所在的路径(poky/build/tmp-glibc/work/aarch64-oe-linux/python3-scikit-learn/0.23.2-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages),我只能在那里看到 numpy 包,但是 scipy包裹不在那里.

Checked the path where the devshell python3 is looking (poky/build/tmp-glibc/work/aarch64-oe-linux/python3-scikit-learn/0.23.2-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages), and i can only see the numpy package there, but scipy package is not there.

ls 命令输出:

 numpy
 numpy-1.17.4-py3.8.egg-info
 pkg_resources
 __pycache__
 README.txt
 setuptools
 setuptools-45.2.0-py3.8.egg-info

有人可以告诉我如何包含 python3-scipy 包,以便将其包含/复制到 devshell.还是我需要更新/修复其他东西.

Can someone point me on how to include the python3-scipy package, so that it will be included/copied to the devshell. Or do I need to update/fix something else.

感谢有关此方面的任何指导.

Appreciate any guidance on this.

推荐答案

你也可以运行:

bitbake -c devshell python3-scipy

并查看配方将所有内容打包到 rootfs 中的确切位置.rootfs 默认是这样的:https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n457

and see exactly where the recipe is packaging everything into the rootfs. The rootfs is by default this: https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n457

IMAGE_ROOTFS = "${WORKDIR}/rootfs"

所以检查一下 python3-scipy 放入 ${WORKDIR}/rootfs 的内容(${WORKDIR} 是您在执行 devshell 后进入的地方,所以只需从那里 cd 到 rootfs).

so check out what python3-scipy puts into ${WORKDIR}/rootfs (${WORKDIR} is where you get thrown into after you execute devshell, so just cd into rootfs from there).

如果 python3-scipy 将它放在不在 PATH 中的某个地方,您可以将其添加到您的路径中.

If python3-scipy puts it into somewhere that is not on the PATH, you can add that to your path.

你可以看到 python3-scipy 如何查找库:https://nofollowgithub.com/gpanders/meta-scipy/blob/1c07824202af668ef1539c3de392cf737c5ba3fd/recipes-devtools/python/python3-scipy_1.5.3.bb#L29

you can see how python3-scipy looks for libraries: https://github.com/gpanders/meta-scipy/blob/1c07824202af668ef1539c3de392cf737c5ba3fd/recipes-devtools/python/python3-scipy_1.5.3.bb#L29

# Tell Numpy to look in target sysroot site-packages directory for libraries
LDFLAGS_append = " -L${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/lib"

这篇关于scikit-learn 的 Yocto 食谱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆