1

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?

  • Why are you using "pip3 install ." ? In your documentation, he applied this command inside the ~/pyadi-iio directory. So maybe instead of using just "." use the actual path of your directory using yocto variable like ${WORKDIR}/${PN}/. for instance. – void_brain Apr 20 '23 at 09:29

1 Answers1

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.

  • 1
    A great method for installing in lieu of an actual setup.py file. One suggestion I would add though is to also inherit `python_flit_core` or just `python3-dir` so that you can use `${PYTHON_SITEPACKAGES_DIR}` so the recipe will be compatible when the Python3 version is upgraded. – mitchellJ May 25 '23 at 21:21