Skip to content

“lxml & xmlsec libxml2 library version mismatch” error under uWSGI #320

Description

@andersk

If libxml2-dev was installed when uWSGI was built, then importing xmlsec within uWSGI leads to an incorrect error xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch'). There’s no such error outside of uWSGI.

(I can work around this error with --no-binary=lxml --no-binary=xmlsec, but that wastes a lot more CI time and shouldn’t be necessary.)

Reproduction in a fresh container:

$ docker run --rm -it ubuntu:22.04root@076333186bac:/# apt updateroot@076333186bac:/# apt install -y gcc libxml2-dev python3-dev python3-venv pkg-configroot@076333186bac:/# python3 -m venv venvroot@076333186bac:/# . venv/bin/activate(venv) root@076333186bac:/# pip install uWSGI xmlsecSuccessfully installed lxml-5.2.1 uWSGI-2.0.25.1 xmlsec-1.3.14(venv) root@076333186bac:/# cat > app.py <<EOFimport xmlsecdef application(env, start_response): start_response("200 OK", [("Content-Type", "text/plain")]) return [b"Hello, world!\n"]EOF(venv) root@076333186bac:/# python -c 'import xmlsec'(venv) root@076333186bac:/# uwsgi --http :9090 --wsgi-file app.py*** Starting uWSGI 2.0.25.1 (64bit) on [Mon May 6 22:18:16 2024] ***compiled with version: 11.4.0 on 06 May 2024 22:17:53os: Linux-6.8.7 #1-NixOS SMP PREEMPT_DYNAMIC Wed Apr 17 09:23:43 UTC 2024nodename: 076333186bacmachine: x86_64clock source: unixdetected number of CPU cores: 12current working directory: /detected binary path: /venv/bin/uwsgi!!! no internal routing support, rebuild with pcre support !!!uWSGI running as root, you can use --uid/--gid/--chroot options*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** WARNING: you are running uWSGI without its master process manager ***your memory page size is 4096 bytesdetected max file descriptor number: 1024lock engine: pthread robust mutexesthunder lock: disabled (you can enable it with --thunder-lock)uWSGI http bound on :9090 fd 4spawned uWSGI http 1 (pid: 4203)uwsgi socket 0 bound to TCP address 127.0.0.1:46691 (port auto-assigned) fd 3uWSGI running as root, you can use --uid/--gid/--chroot options*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]*** Python threads support is disabled. You can enable it with --enable-threads ***Python main interpreter initialized at 0x55a23eea0bc0uWSGI running as root, you can use --uid/--gid/--chroot options*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** your server socket listen backlog is limited to 100 connectionsyour mercy for graceful operations on workers is 60 secondsmapped 72904 bytes (71 KB) for 1 cores*** Operational MODE: single process ***Traceback (most recent call last): File "app.py", line 1, in <module> import xmlsecxmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch')unable to load app 0 (mountpoint='') (callable not found or import error)*** no app loaded. going in full dynamic mode ***uWSGI running as root, you can use --uid/--gid/--chroot options*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** uWSGI is running in multiple interpreter mode ***spawned uWSGI worker 1 (and the only) (pid: 4202, cores: 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions