如何使用pip在Yocto配方中安装模块

huangapple go评论91阅读模式
英文:

How to use pip to install module in Yocto recipe

问题

I am updating my pyadi-iio installation recipe from 0.0.14 to 0.0.15. However, the newer version no longer uses setup.py, and the new recommended way to install from source is pip install ..

Based on this question, I changed my recipe from:

LICENSE = "CLOSED"
 
SRC_URI[md5sum] = "d258374fab29540e9f9ee38d36257a2e"
SRC_URI[sha256sum] = "fb6a9a47ed4af5a5c50819cf9973a93ea7148c2b70d775edb71bdf0e7da292b6"
 
PYPI_PACKAGE = "pyadi-iio"
 
inherit pypi setuptools3
 
RDEPENDS:${PN} += " python3-numpy"

to

LICENSE = "CLOSED"
 
SRC_URI[md5sum] = "ea94069ddb468988fe5a6465ecdf3ac1"
SRC_URI[sha256sum] = "c3d04f027ea1d4660da825f2f2c2843f7a3d7876fa5e0c3f46725f70ccd08365"
 
PYPI_PACKAGE = "pyadi-iio"
 
inherit pypi
 
DEPENDS = "python3-pip-native"
 
RDEPENDS:${PN} += " python3-numpy"
 
do_install() {
    pip3 install .
}

However, I get an error saying pip can't access my .cache/pip folder.

How do I install a python package without setuptools3 and using pip?

英文:

I am updating my pyadi-iio installation recipe from 0.0.14 to 0.0.15. However the newer version no longer uses setup.py the new recommended way to install from source is pip install ..

Based on this question, I changed my recipe from:

LICENSE = "CLOSED"
 
SRC_URI[md5sum] = "d258374fab29540e9f9ee38d36257a2e"
SRC_URI[sha256sum] = "fb6a9a47ed4af5a5c50819cf9973a93ea7148c2b70d775edb71bdf0e7da292b6"
 
PYPI_PACKAGE = "pyadi-iio"
 
inherit pypi setuptools3
 
RDEPENDS:${PN} += " python3-numpy"

to

LICENSE = "CLOSED"
 
SRC_URI[md5sum] = "ea94069ddb468988fe5a6465ecdf3ac1"
SRC_URI[sha256sum] = "c3d04f027ea1d4660da825f2f2c2843f7a3d7876fa5e0c3f46725f70ccd08365"
 
PYPI_PACKAGE = "pyadi-iio"
 
inherit pypi
 
DEPENDS = "python3-pip-native"
 
RDEPENDS:${PN} += " python3-numpy"
 
do_install() {
    pip3 install .
}

However, I get an error saying pip can't access my .cashe/pip folder.

How do I install a python package without setuptools3 and using pip?

答案1

得分: 1

I got it to work by not using pip and instead using install and cp.

LICENSE = "CLOSED"

SRC_URI[md5sum] = "ea94069ddb468988fe5a6465ecdf3ac1"
SRC_URI[sha256sum] = "c3d04f027ea1d4660da825f2f2c2843f7a3d7876fa5e0c3f46725f70ccd08365"

PYPI_PACKAGE = "pyadi-iio"

inherit pypi

RDEPENDS:${PN} += " python3-numpy"

FILES:${PN} += "${libdir}/python3.10/site-packages/adi ${libdir}/python3.10/site-packages/pyadi_iio.egg-info"

DIRFILES = "1"

do_install() {
	install -m 777 -d ${D}${libdir}/python3.10/site-packages/
	cp -r ${S}/pyadi_iio.egg-info ${D}${libdir}/python3.10/site-packages/pyadi_iio.egg-info
	cp -r ${S}/adi ${D}${libdir}/python3.10/site-packages/adi
}

I was getting a file conflict error when building the image, adding DIRFILES = "1" fixed the problem based on this answer.

英文:

I got it to work by not using pip and instead using install and cp.

LICENSE = "CLOSED"
 
SRC_URI[md5sum] = "ea94069ddb468988fe5a6465ecdf3ac1"
SRC_URI[sha256sum] = "c3d04f027ea1d4660da825f2f2c2843f7a3d7876fa5e0c3f46725f70ccd08365"
 
PYPI_PACKAGE = "pyadi-iio"
 
inherit pypi
 
RDEPENDS:${PN} += " python3-numpy"
 
FILES:${PN} += "${libdir}/python3.10/site-packages/adi ${libdir}/python3.10/site-packages/pyadi_iio.egg-info"
 
DIRFILES = "1"
 
do_install() {
	install -m 777 -d ${D}${libdir}/python3.10/site-packages/
	cp -r ${S}/pyadi_iio.egg-info ${D}${libdir}/python3.10/site-packages/pyadi_iio.egg-info
	cp -r ${S}/adi ${D}${libdir}/python3.10/site-packages/adi
}

I was getting a file conflict error when building the image, adding DIRFILES = "1" fixed the problem based on this answer.

huangapple
  • 本文由 发表于 2023年4月20日 02:58:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057986.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定