Error building Pymodbus

Facing error building pymodbus:

Initialising tasks: 100% |#######################################| Time: 0:00:00
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: pymodbus-2.5+gitAUTOINC+731b080df0-r0 do_compile: python setup.py build execution failed.
ERROR: pymodbus-2.5+gitAUTOINC+731b080df0-r0 do_compile: Function failed: do_compile (log file is located at /home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/pymodbus/2.5+gitAUTOINC+731b080df0-r0/temp/log.do_compile.15160)
ERROR: Logfile of failure stored in: /home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/pymodbus/2.5+gitAUTOINC+731b080df0-r0/temp/log.do_compile.15160
Log data follows:
| DEBUG: Executing shell function do_compile
| Traceback (most recent call last):
| File “setup.py”, line 28, in
| from pymodbus.utilities import IS_PYTHON3
| File “/home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/pymodbus/2.5+gitAUTOINC+731b080df0-r0/git/pymodbus/utilities.py”, line 8, in
| from pymodbus.compat import int2byte, byte2int, IS_PYTHON3
| File “/home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/pymodbus/2.5+gitAUTOINC+731b080df0-r0/git/pymodbus/compat.py”, line 15, in
| import six
| ImportError: No module named six
| ERROR: python setup.py build execution failed.
| WARNING: /home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/pymodbus/2.5+gitAUTOINC+731b080df0-r0/temp/run.do_compile.15160:1 exit 1 from ‘exit 1’
| ERROR: Function failed: do_compile (log file is located at /home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/pymodbus/2.5+gitAUTOINC+731b080df0-r0/temp/log.do_compile.15160)
ERROR: Task (/home/pankaj/Documents/wp76xx-linuxsrc-rel13.1/yocto/meta-openembedded/meta-python/recipes-devtools/python/pymodbus_2.5.2.bb:do_compile) failed with exit code ‘1’
NOTE: Tasks Summary: Attempted 655 tasks of which 654 didn’t need to be rerun and 1 failed.

Python six is already installed in the image though local.conf
IMAGE_INSTALL_append_pn-mdm9x28-image-minimal = " python-six python-paho-mqtt"

pymodbus recipe is created using the recipetool in Bitbake command:

recipetool -d create -o yocto/meta-openembedded/meta-python/recipes-devtools/python/pymodbus_2.5.2.bb GitHub - riptideio/pymodbus: A full modbus protocol written in python

Attached is the recipe which is giving error .

looking for any modifications required to build the recipe
pymodbus_2.5.2.bb (4.1 KB)

how about adding the following recipe in
./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc

IMAGE_INSTALL_append =" pymodbus"

@jyijyi

Will try the suggestion but I think it should not make a difference as "IMAGE_INSTALL_append_pn-mdm9x28-image-minimal mentions the correct target to add the recipe.

In case if python six is not installed I believe Rdepends should take care of providing a error but it doesn’t. Below is the RDEPENDS from the recipe:

RDEPENDS_${PN} += “python-2to3 python-contextlib python-core python-crypt python-distutils python-io python-json python-lang python-logging python-math python-netserver python-setuptools python-shell python-six python-threading python-unittest”

So ideally I should have got a build error with no provider for Python-six , but rather I see error reported on import statement in compat.py

I believe may have to add some tasks intially before compiling pymodbus

I found that I cannot add
IMAGE_INSTALL_append =" python-pymodbus"

it seems it is not officially supported.

Hi Pankaj,

If you are trying to make a Modbus master, maybe have a quick read of this wiki link,
https://bitbucket.org/m2mconnectivity/pyrtedoc/wiki/Modbus%20master
If it helps, here is the home of wiki which tries to include Python3 and popular modules(such as pyserial, requests) without rebuilding Linux image for Legato modules/FX30s,
m2mconnectivity / PyRTEdoc / wiki / Home — Bitbucket

@billzhou

Yes looking for Modbus master this one looks to be helpful the implementation seems to be based on Minimal Modbus which supports only RTU any suggestions for modbus TCP.

Hi Pankaj,

Here pls find the guide on how to install Python modules without rebuilding image and it uses PyModbus as example,
m2mconnectivity / PyRTEdoc / wiki / Install a Python module — Bitbucket

Hope it helps.

@billzhou

Can you let me know where do we get the pyrte application?

Thanks

Pankaj Sant

Hi Pankaj,

The download page of PyRTE looks not ready. If you’d need it now, please message me your email, with your FX30/WP model and firmware version, I’d be happy to arrange you the installers.

@billzhou ,

you can email me the installers for wp76 rel13.1 firmware on pankajrsant@gmail.com

The free download page for PyRTE is here if any one needs it,

Currently it supports FX30 Cat M1 and WP7702. Firmware Release 14.

Hi, I have some similar issue, as I am trying to add Pymodbus to my image as a library I get the following error as building:

ERROR: python3-pymodbus-2.5.3-r0 do_compile: 'python3 setup.py build ' execution failed.
ERROR: python3-pymodbus-2.5.3-r0 do_compile: Execution of '/home/usr/reterminal-yocto/build/tmp/work/aarch64-poky-linux/python3-pymodbus/2.5.3-r0/temp/run.do_compile.949277' failed with exit code 1
ERROR: Logfile of failure stored in: /home/usr/reterminal-yocto/build/tmp/work/aarch64-poky-linux/python3-pymodbus/2.5.3-r0/temp/log.do_compile.949277
Log data follows:
| DEBUG: Executing shell function do_compile
| Traceback (most recent call last):
|   File "setup.py", line 28, in <module>
|     from pymodbus.utilities import IS_PYTHON3
|   File "/home/usr/reterminal-yocto/build/tmp/work/aarch64-poky-linux/python3-pymodbus/2.5.3-r0/pymodbus-2.5.3/pymodbus/utilities.py", line 8, in <module>
|     from pymodbus.compat import int2byte, byte2int, IS_PYTHON3
|   File "/home/usr/reterminal-yocto/build/tmp/work/aarch64-poky-linux/python3-pymodbus/2.5.3-r0/pymodbus-2.5.3/pymodbus/compat.py", line 15, in <module>
|     import six
| ModuleNotFoundError: No module named 'six'
| ERROR: 'python3 setup.py build ' execution failed.
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/usr/reterminal-yocto/build/tmp/work/aarch64-poky-linux/python3-pymodbus/2.5.3-r0/temp/run.do_compile.949277' failed with exit code 1
ERROR: Task (/home/jprobst/TUTO_PROPRES/reterminal-yocto/layers/meta-coperametrix-cm4_gui/recipes-modbustcp/modbustcp/python3-pymodbus_2.5.3.bb:do_compile) failed with exit code '1'

Here is my python3-Pymodbus_version.bb file:

SUMMARY = "A fully featured modbus protocol stack in python"
HOMEPAGE = "https://github.com/riptideio/pymodbus/"
AUTHOR = "Galen Collins <bashwork@gmail.com>"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2c2223d66c7e674b40527b5a4c35bd76"

SRC_URI = "https://files.pythonhosted.org/packages/fe/a9/f98aadfcb8d0a34326be68a06a72cc60e04139e8f4fd17633972f8af3b4c/pymodbus-2.5.3.tar.gz"
SRC_URI[md5sum] = "28e8ac7f84adace83319d3733e00dee8"
SRC_URI[sha256sum] = "5ef68c1a109bdb467c830ef003ef2db6494349a5248e4af946fe21c9eefe7e74"

S = "${WORKDIR}/pymodbus-2.5.3"

RDEPENDS_${PN} += "python3-six python3-pyserial"

inherit setuptools3

I searched for a long time and have no clue where this error could come from as even when I manually Image_install_append six, it still says that I cannot be found. I am not really used to building yocto images yet so I would be really grateful if you could help me understand what I missmade

Hi @billzhou , can you share your bb file

@jyijyi I don’t have a bb file for PyModbus but I can try to give a fix.
@yuser
Can you please try to add below line in you bb and give it a go?
DEPENDS += “python3-six-native”

2 Likes

I just found that we need to add


inherit python3native

DEPENDS += "python3-six-native"

Here is my bb file and I can make the yocto image:
python3-pymodbus_2.5.3.bb (700 Bytes)

1 Like

Hi @billzhou @jyijyi I added your lines

inherit python3native
DEPENDS += "python3-six-native"

And it also worked fine for me thanks!
Do you perhaps have an idea as to why we need to add theses?

you can see these two webpages:

https://www.yoctoproject.org/pipermail/yocto/2018-March/040193.html

1 Like