cancel
Showing results for 
Search instead for 
Did you mean: 

How to install the development packages of libxml2 and libxslt

Jaison M
Associate II

I have a STM32MP157F-DK2 board.

I have installed the distribution package from the tutorials from st.com. I want to install the lxml package which seems to need the libxml2 and libxslt development packages as dependencies, but these packages are not available in the apt manager.

How do I install them with the present distribution package. I am very much newbie in this field, so providing step-by-step methods or reference to an easily understandable documentation is appreciated 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

@Jaison M​ 

I just checked this recipe:

DESCRIPTION = "A modern/fast Python SOAP client based on lxml / requests."
HOMEPAGE = "https://docs.python-zeep.org/en/master/"
SECTION = "devel/python"
 
AUTHOR = "Michael van Tellingen"
 
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=8c4f352744f3f0b50054eef4215eeb95"
 
SRC_URI[md5sum] = "f689cc06cefb6ee95b2254b80d0ebd30"
SRC_URI[sha256sum] = "5867f2eadd6b028d9751f4155af590d3aaf9280e3a0ed5e15a53343921c956e5"
 
PYPI_PACKAGE = "zeep"
 
inherit pypi setuptools3
 
BBCLASSEXTEND += "native nativesdk"
 
RDEPENDS_${PN} += " ${PYTHON_PN}-lxml"

It builds and I have successfully installed the package on my board (stm32mp157c-dk2):

root@stm32mp1:~# apt-cache policy python3-zeep
python3-zeep:
  Installed: (none)
  Candidate: 4.1.0-r0.1
  Version table:
     4.1.0-r0.1 500
        500 http://XXXXX  Packages
root@stm32mp1:~# apt-get install --assume-yes python3-zeep
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libxslt python3-lxml
The following NEW packages will be installed:
  libxslt python3-lxml python3-zeep
0 upgraded, 3 newly installed, 0 to remove and 746 not upgraded.
Need to get 1236 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://XXXXX libxslt 1.1.35-r0.0 [96.4 kB]
Get:2 http://XXXXX    python3-lxml 4.8.0-r0.0 [997 kB]
Get:3 http://XXXXX    python3-zeep 4.1.0-r0.1 [143 kB]
Fetched 1236 kB in 1s (1544 kB/s)
 
The software package is provided AS IS, and by downloading it, you agree to be
bound to the terms of the software license agreement (SLA).
The detailed content licenses can be found at
https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_licenses.
 
Selecting previously unselected package libxslt.
(Reading database ... 14853 files and directories currently installed.)
Preparing to unpack .../libxslt_1.1.35-r0.0_armhf.deb ...
Unpacking libxslt (1.1.35-r0.0) ...
Selecting previously unselected package python3-lxml.
Preparing to unpack .../python3-lxml_4.8.0-r0.0_armhf.deb ...
Unpacking python3-lxml (4.8.0-r0.0) ...
Selecting previously unselected package python3-zeep.
Preparing to unpack .../python3-zeep_4.1.0-r0.1_armhf.deb ...
Unpacking python3-zeep (4.1.0-r0.1) ...
Setting up libxslt (1.1.35-r0.0) ...
Setting up python3-lxml (4.8.0-r0.0) ...
Setting up python3-zeep (4.1.0-r0.1) ...

Best regards,

--JM

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'.

View solution in original post

12 REPLIES 12
Jean-Marc B
ST Employee

Hello @Jaison M​ 

The current OpenSTLinux distribution doesn't provide the lxml package nor *-dev packages. However, we provide the package python3-lxml:

root@stm32mp1:~# apt-cache policy python3-lxml
python3-lxml:
  Installed: (none)
  Candidate: 4.5.0-r0
  Version table:
     4.5.0-r0 500
        500 http://packages.openstlinux.st.com/3.1 dunfell/main armhf Packages

May this package fit your needs?

Best regards,

--JM

Jaison M
Associate II

Umm, not sure but let me try, I'm trying to use ZEEP package for SOAP protocol for onvif cameras. It needs lxml as a dependency for parsing the xml messages I guess.. on "pip3 install zeep", it tries to install lxml and gives out this error:

"Collecting lxml>=4.6.0

 Using cached lxml-4.9.0.tar.gz (3.4 MB)

  ERROR: Command errored out with exit status 1:

   command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xptc_wih/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xptc_wih/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-xptc_wih/lxml/pip-egg-info

     cwd: /tmp/pip-install-xptc_wih/lxml/

  Complete output (3 lines):

  Building lxml version 4.9.0.

  Building without Cython.

  Error: Please make sure the libxml2 and libxslt development packages are installed.

  ----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output."

""

Jaison M
Associate II

Tried it, still same issue

Hi @Jaison M​ 

Ok, I understand your point.

We currently don't offer development environment on the board itself. That means commands such as pip3 install may fail depending on a required build process. It seems to happen with the zeep module.

You need to create your own recipe. This is a wiki page which details how to do it.

Your recipe (name it python3-zeep.bb) should look like:

DESCRIPTION = "A modern/fast Python SOAP client based on lxml / requests."
HOMEPAGE = "https://docs.python-zeep.org/en/master/"
SECTION = "devel/python"
 
AUTHOR = "Michael van Tellingen"
 
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=8c4f352744f3f0b50054eef4215eeb95"
 
SRC_URI[md5sum] = "***"
SRC_URI[sha256sum] = "***"
 
PYPI_PACKAGE = "zeep"
 
inherit pypi setuptools3
 
DEPENDS= " lxml"

I didn't test it but you should have a nice starting point with this recipe. Just fix the "***" when running the bitbake python3-zeep command and adjust the DEPENDS value.

I will try to integrate this recipe in our next OpenSTLinux release.

Best regards,

--JM

OK, first of all, thanks for the quick responses 😊 and the recipe. I'll read the wiki and will try it within few hours and will let you know the output.

Jaison M
Associate II

So I tried it, added the layer successfully, replaced those "***" with zeep's md5sum and sha256sum, added the layer path to the BBLAYERS of bblayers.conf.

When I run the bitbake python3-zeep, i get this error regarding lxml.

/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1$ bitbake python3-zeep
NOTE: Started PRServer with DBfile: /media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 43637, PID: 7476
Loading cache: 100% |#######################################################################################################################################################################| Time: 0:00:00
Loaded 3957 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
ERROR: Nothing PROVIDES 'lxml' (but /media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/layers/meta-st/meta-zeep/recipes-custom/zeep/python3-zeep.bb DEPENDS on or otherwise requires it). Close matches:
  libmxml
  libxml2
  lxdm
ERROR: Required build target 'python3-zeep' has no buildable providers.
Missing or unbuildable dependency chain was: ['python3-zeep', 'lxml']
 
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

I guess we have to give a source for lxml ? How do I fix this error? 😊

Edit* - Modified recipe:

DESCRIPTION = "A modern/fast Python SOAP client based on lxml / requests."
HOMEPAGE = "https://docs.python-zeep.org/en/master/"
SECTION = "devel/python"
 
AUTHOR = "Michael van Tellingen"
 
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=8c4f352744f3f0b50054eef4215eeb95"
 
SRC_URI[md5sum] = "f689cc06cefb6ee95b2254b80d0ebd30"
SRC_URI[sha256sum] = "5867f2eadd6b028d9751f4155af590d3aaf9280e3a0ed5e15a53343921c956e5"
 
PYPI_PACKAGE = "zeep"
 
inherit pypi setuptools3
 
DEPENDS= " lxml"

Take a look on this error.

Hello @Jaison M​ 

I am sorry for the typos but I didn't check the recipe on-live yesterday (and I didn't do it today too 😉 )

First of all, rename the recipe filename into python3-zeep-4.1.0.bb as it targets the version 4.1.0. It will avoid any confusion later.

Then the error you see while building the recipe is coming from the DEPENDS value. I think it should be replaced by libmxml as suggested by the error message you got.

By the way, I thank you for the updated recipe.

Best regards,

--JM

Okay, I'm doing it now, will let you know the output on bitbake python3-zeep-4.1.0.

But just a doubt, these are the lines from zeep documentation:

"Zeep is a pure-python module. This means that there is no C code which needs to be compiled. However the lxml dependency does contain C code since it uses libxml2 and libxslt. For linux/bsd this means you need to install libxml2-dev and libxslt-dev packages. For Windows this is unfortunately a bit more complicated. The easiest way is to install lxml via wheel files since that contains already compiled code for your platform."

Even if the build is successful with libxml2 in DEPENDS, if lxml is not present, will zeep package work properly? Or can the python3-lxml can do the job for rest? For now I'm gonna try, I'll let you know if it works or not 🙂

Update: Right now, I'm getting failed to fetch URL error

ERROR: python3-zeep-4.1.0-1.0-r0 do_fetch: Fetcher failure for URL: 'https://files.pythonhosted.org/packages/source/z/zeep/zeep-1.0.tar.gz'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3-zeep-4.1.0/1.0-r0/temp/log.do_fetch.4367
ERROR: Task (/media/jaison/ecrio/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/layers/meta-st/meta-zeep/recipes-custom/zeep/python3-zeep-4.1.0.bb:do_fetch) failed with exit code '1'

I checked the given URL with wget command, and it gives an 404 error, how do I change the source url?