英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论