Opened 4 months ago

Last modified 4 months ago

#19068 new enhancement

lxml-5.0.0 (Python Module) (Wait for Cython-3 to be in the book)

Reported by: Douglas R. Reno Owned by: blfs-book
Priority: normal Milestone: 99-Waiting
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

New major version

Change History (2)

comment:1 by Douglas R. Reno, 4 months ago

Milestone: 12.199-Waiting
Summary: lxml-5.0.0 (Python Module)lxml-5.0.0 (Python Module) (Wait for Cython-3 to be in the book)

This package will require Cython-3.x. We can't upgrade to Cython-3.x at the moment though due to pyyaml. It looks like pyyaml needs some significant changes to get there, and it was pinned at a prior version of Cython at https://github.com/yaml/pyyaml/pull/702

If we try to build lxml right now, we'll get:

      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python3.11 -c src/lxml/builder.c -o build/temp.linux-x86_64-cpython-311/src/lxml/builder.o -w
      src/lxml/builder.c: In function ‘__Pyx_PyErr_GetTopmostException’:
      src/lxml/builder.c:8038:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8038 |     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
            |                     ^~
      src/lxml/builder.c:8038:51: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8038 |     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
            |                                                   ^~
      src/lxml/builder.c: In function ‘__Pyx__ExceptionSave’:
      src/lxml/builder.c:8052:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8052 |     *type = exc_info->exc_type;
            |                     ^~
      src/lxml/builder.c:8054:19: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       8054 |     *tb = exc_info->exc_traceback;
            |                   ^~
      src/lxml/builder.c: In function ‘__Pyx__ExceptionReset’:
      src/lxml/builder.c:8068:24: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8068 |     tmp_type = exc_info->exc_type;
            |                        ^~
      src/lxml/builder.c:8070:22: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       8070 |     tmp_tb = exc_info->exc_traceback;
            |                      ^~
      src/lxml/builder.c:8071:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8071 |     exc_info->exc_type = type;
            |             ^~
      src/lxml/builder.c:8073:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       8073 |     exc_info->exc_traceback = tb;
            |             ^~
      src/lxml/builder.c: In function ‘__Pyx__GetException’:
      src/lxml/builder.c:8144:28: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8144 |         tmp_type = exc_info->exc_type;
            |                            ^~
      src/lxml/builder.c:8146:26: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       8146 |         tmp_tb = exc_info->exc_traceback;
            |                          ^~
      src/lxml/builder.c:8147:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
       8147 |         exc_info->exc_type = local_type;
            |                 ^~
      src/lxml/builder.c:8149:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
       8149 |         exc_info->exc_traceback = local_tb;
            |                 ^~
      src/lxml/builder.c: In function ‘__Pyx_AddTraceback’:
      src/lxml/builder.c:614:62: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
        614 |   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
            |                                                              ^~
      src/lxml/builder.c:11109:5: note: in expansion of macro ‘__Pyx_PyFrame_SetLineNumber’
      11109 |     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      Compile failed: command '/usr/bin/gcc' failed with exit code 1
      creating tmp
      cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitjyp4f95a.c -o tmp/xmlXPathInitjyp4f95a.o
      /tmp/xmlXPathInitjyp4f95a.c: In function ‘main’:
      /tmp/xmlXPathInitjyp4f95a.c:3:5: warning: ‘xmlXPathInit’ is deprecated [-Wdeprecated-declarations]
          3 |     xmlXPathInit();
            |     ^~~~~~~~~~~~
      In file included from /tmp/xmlXPathInitjyp4f95a.c:1:
      /usr/include/libxml2/libxml/xpath.h:564:21: note: declared here
        564 |                     xmlXPathInit                (void);
            |                     ^~~~~~~~~~~~
      cc tmp/xmlXPathInitjyp4f95a.o -lxml2 -o a.out
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
ERROR: Failed to build one or more wheels

The members that it mentions were added in Cython-3. Looking over at requirements.txt confirms this:

renodr [ /sources/lxml-5.0.0 ]$ cat requirements.txt
Cython>=3.0.7

Moving to 99-waiting...

comment:2 by martyj19, 4 months ago

Unlike the book I don't need the things you are waiting for.

Adding Cython 3.0.7 and building lxml 5.0.0 does build successfully and the resulting lxml does appear to work on a spot check of two packages that use it. You do however need the --with-cython flag in the lxml build to avoid those undefineds.

The closest I am able to come to the standard workflow replaces the "pip3 wheel" with

python3 setup.py bdist_wheel --with-cython

as suggested by https://lxml.de/build.html

Note: See TracTickets for help on using tickets.