【问题标题】:Yocto Bitbake podman-py setuptools installation from Github fails从 Github 安装 Yocto Bitbake podman-py setuptools 失败
【发布时间】:2021-06-27 18:58:39
【问题描述】:

我正在使用 Yocto 为嵌入式 Linux 目标构建操作系统映像。 Yocto 在 Ubuntu 20.04 上运行,所有元层都使用了 dunfell。

生成的图像已安装 Python 3.8,并包含 python3-requests 包。

现在,我正在尝试编写一个 bitbake 配方来安装 'podman-py' (https://github.com/containers/podman-py) 包(不在 PyPi 上)。

这是我当前版本的 bitbake 食谱:

SUMMARY = "This python package is a set of bindings to use the new RESTful API in libpod."
HOMEPAGE = "https://github.com/containers/podman-py"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"

inherit setuptools3

DEPENDS += "python3-requests"

SRCREV = "312b7434843e2ff653e46f9c837e6eeb491c8bff"
PV = "1.0.0+git${SRCPV}"

S = "${WORKDIR}/git"
SRC_URI="git://git@github.com/containers/podman-py.git;branch=master;protocol=ssh"

DEPENDS += "python3-pip-native"

即使我在生成的图像中成功安装了 python3-requests,Yocto 也会抛出以下错误:

| ModuleNotFoundError: No module named 'requests'
| ERROR: 'python3 setup.py build ' execution failed.
| WARNING: /home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/temp/run.do_compile.50185:1 exit 1 from 'exit 1'
| ERROR: Execution of '/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/temp/run.do_compile.50185' failed with exit code 1:
| Traceback (most recent call last):
|   File "/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/git/setup.py", line 3, in <module>
|     import podman
|   File "/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/git/podman/__init__.py", line 4, in <module>
|     from podman.api_connection import ApiConnection
|   File "/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/git/podman/api_connection.py", line 10, in <module>
|     import podman.containers as containers
|   File "/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/git/podman/containers/__init__.py", line 7, in <module>
|     import podman.errors as errors
|   File "/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/git/podman/errors/__init__.py", line 8, in <module>
|     from .exceptions import APIError, ImageNotFound, NotFound
|   File "/home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/git/podman/errors/exceptions.py", line 5, in <module>
|     from requests import Response
| ModuleNotFoundError: No module named 'requests'
| WARNING: /home/me/Desktop/poky/build-microchip/tmp/work/cortexa5t2hf-neon-vfpv4-poky-linux-musleabi/python3-podman-py/1.0.0+gitAUTOINC+312b743484-r0/temp/run.do_compile.50185:1 exit 1 from 'exit 1'

如何让这个包用 Yocto 构建?谢谢。

【问题讨论】:

  • 也许这是PYTHONPATH 问题?您能否显示目录结构(使用树)并显示任何可能相关的 Python 环境变量。

标签: python-3.x linux yocto bitbake podman


【解决方案1】:

我不熟悉 podman-py,但是从查看您的配方 DEPENDS += "python3-requests" 来看,requests 是一个构建依赖项。但python3-requests 实际上是您的目标版本,在您的构建主机上找不到。

因此,您需要 DEPENDS += "python3-requests-native" 作为构建依赖项才能在构建主机上运行它。 如果您想向 requests 添加运行时依赖项(以便在目标机器上运行它),您需要添加 RDEPENDS_${PN} += "python3-requests"

我成功地烘焙了这个python3-podman-py_git.bb 食谱:

SUMMARY = "This python package is a set of bindings to use the new RESTful API in libpod."
HOMEPAGE = "https://github.com/containers/podman-py"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"

inherit setuptools3

S = "${WORKDIR}/git"
SRC_URI="git://git@github.com/containers/podman-py.git;branch=master;protocol=ssh"
SRCREV = "312b7434843e2ff653e46f9c837e6eeb491c8bff"

DEPENDS += "python3-pip-native python3-requests-native"

BBCLASSEXTEND = "native nativesdk"

但是我无法在目标系统上对其进行测试,因此您可能需要包含一些运行时依赖项。

编辑: 我有点困惑为什么configure 任务甚至想要运行/加载一些 podman-py pyhton 代码。因为configure基本上只调用python3 setup.py clean。但是 podmans setup.py 中有一个 import podman,因此运行时依赖项也需要原生存在。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-30
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    相关资源
    最近更新 更多