Install lxml

Hello,

#The execution of the command :

apt-get install python3-lxml

#Genere

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-lxml : Depends: python3 (< 3.5) but 3.7.2-1 is to be installed
E: Unable to correct problems, you have held broken packages.

Thanks,

La commande :

pip3 install  lxml

me génère :

Downloading/unpacking lxml
  Downloading lxml-4.3.1.tar.gz (4.4MB): 4.4MB downloaded
  Running setup.py (path:/tmp/pip-build-_qlo6zjf/lxml/setup.py) egg_info for package lxml
    Building lxml version 4.3.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    /tmp/pip-build-_qlo6zjf/lxml/setup.py:12: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
      sys.exit(1)
Installing collected packages: lxml
  Running setup.py install for lxml
    Building lxml version 4.3.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    building 'lxml.etree' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python3.7m -c src/lxml/etree.c -o build/temp.linux-x86_64-3.7/src/lxml/etree.o -w
    In file included from /usr/include/libxslt/xsltInternals.h:24,
                     from src/lxml/etree.c:718:
    /usr/include/libxslt/xsltlocale.h:19:10: fatal error: xlocale.h: No such file or directory
     #include <xlocale.h>
              ^~~~~~~~~~~
    compilation terminated.
    Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitr9utwi5l.c -o tmp/xmlXPathInitr9utwi5l.o
    /tmp/xmlXPathInitr9utwi5l.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
     main (int argc, char **argv) {
     ^~~~
    cc tmp/xmlXPathInitr9utwi5l.o -lxml2 -o a.out
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-_qlo6zjf/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-39n98e9_-record/install-record.txt --single-version-externally-managed --compile:
    Building lxml version 4.3.1.

Building without Cython.

Using build configuration of libxslt 1.1.28

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-3.7

creating build/lib.linux-x86_64-3.7/lxml

copying src/lxml/builder.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/__init__.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/sax.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/cssselect.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-3.7/lxml

creating build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/__init__.py -> build/lib.linux-x86_64-3.7/lxml/includes

creating build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/_html5builder.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/ElementSoup.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/builder.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/__init__.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/_diffcommand.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/soupparser.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/_setmixin.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/diff.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/clean.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/html5parser.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/usedoctest.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/formfill.py -> build/lib.linux-x86_64-3.7/lxml/html

copying src/lxml/html/defs.py -> build/lib.linux-x86_64-3.7/lxml/html

creating build/lib.linux-x86_64-3.7/lxml/isoschematron

copying src/lxml/isoschematron/__init__.py -> build/lib.linux-x86_64-3.7/lxml/isoschematron

copying src/lxml/etree.h -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/etree_api.h -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/lxml.etree.h -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/lxml.etree_api.h -> build/lib.linux-x86_64-3.7/lxml

copying src/lxml/includes/schematron.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/uri.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/config.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/c14n.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/__init__.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/xpath.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/xinclude.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/relaxng.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/tree.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/xslt.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/etree_defs.h -> build/lib.linux-x86_64-3.7/lxml/includes

copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-3.7/lxml/includes

creating build/lib.linux-x86_64-3.7/lxml/isoschematron/resources

creating build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/rng

copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/rng

creating build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl

creating build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

creating build/temp.linux-x86_64-3.7

creating build/temp.linux-x86_64-3.7/src

creating build/temp.linux-x86_64-3.7/src/lxml

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python3.7m -c src/lxml/etree.c -o build/temp.linux-x86_64-3.7/src/lxml/etree.o -w

In file included from /usr/include/libxslt/xsltInternals.h:24,

                 from src/lxml/etree.c:718:

/usr/include/libxslt/xsltlocale.h:19:10: fatal error: xlocale.h: No such file or directory

 #include <xlocale.h>

          ^~~~~~~~~~~

compilation terminated.

Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 1

creating tmp

cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitr9utwi5l.c -o tmp/xmlXPathInitr9utwi5l.o

/tmp/xmlXPathInitr9utwi5l.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]

 main (int argc, char **argv) {

 ^~~~

cc tmp/xmlXPathInitr9utwi5l.o -lxml2 -o a.out

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-_qlo6zjf/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-39n98e9_-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-_qlo6zjf/lxml
Storing debug log for failure in /root/.pip/pip.log

Le paquet que tu cherche à installer est bien disponible et présent sur Stretch.
https://packages.debian.org/stretch/python3-lxml

Quel est la version de ta Debian ?
Peux-tu fournir plus d’informations comme par exemple ton fichiers de sources en intégralité ?

Bonjour,

Merci pour votre aide.
La commande :

dpkg -i python3-lxml_3.7.1-1_amd64.deb

Génère :

Selecting previously unselected package python3-lxml.
(Reading database ... 90313 files and directories currently installed.)
Preparing to unpack python3-lxml_3.7.1-1_amd64.deb ...
Unpacking python3-lxml (3.7.1-1) ...
dpkg: dependency problems prevent configuration of python3-lxml:
 python3-lxml depends on python3 (<< 3.6); however:
  Version of python3 on system is 3.7.2-1.

dpkg: error processing package python3-lxml (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3-lxml
3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64 GNU/Linux

Merci une autre fois

J’ai télécharger lxml-4.3.1
les commandes :

cd lxml-4.3.1
make

Donnent :

python setup.py  build_ext -i  --warnings --with-coverage
Building lxml version 4.3.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
running build_ext
building 'lxml.etree' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/lxml
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DCYTHON_TRACE_NOGIL=1 -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python2.7 -c src/lxml/etree.c -o build/temp.linux-x86_64-2.7/src/lxml/etree.o
In file included from /usr/include/libxslt/xsltInternals.h:24,
                 from src/lxml/etree.c:718:
/usr/include/libxslt/xsltlocale.h:19:10: fatal error: xlocale.h: No such file or directory
 #include <xlocale.h>
          ^~~~~~~~~~~
compilation terminated.
Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 1
creating tmp
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitOvn8xW.c -o tmp/xmlXPathInitOvn8xW.o
/tmp/xmlXPathInitOvn8xW.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main (int argc, char **argv) {
 ^~~~
cc tmp/xmlXPathInitOvn8xW.o -lxml2 -o a.out
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Makefile:26: recipe for target 'inplace' failed
make: *** [inplace] Error 1

Merci