Closed marceloalencar closed 7 months ago
The project page shows the package's apt dependencies: https://www.piwheels.org/project/lxml/
For the cp311 build, the wheel depends on extra libraries:
sudo apt install libxslt1.1 libstdc++6 libicu72 libxml2 libgcrypt20
Exactly. It still didn't work.
Verbose output:
Python 3.11.6 (main, Nov 1 2023, 09:03:26) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
[...]
# /usr/local/lib/python3.11/site-packages/lxml/__pycache__/__init__.cpython-311.pyc matches /usr/local/lib/python3.11/site-packages/lxml/__init__.py
# code object from '/usr/local/lib/python3.11/site-packages/lxml/__pycache__/__init__.cpython-311.pyc'
import 'lxml' # <_frozen_importlib_external.SourceFileLoader object at 0xb6714c90>
# trying /usr/local/lib/python3.11/site-packages/lxml/etree.cpython-311-arm-linux-gnueabi.so
# trying /usr/local/lib/python3.11/site-packages/lxml/etree.abi3.so
# trying /usr/local/lib/python3.11/site-packages/lxml/etree.so
# trying /usr/local/lib/python3.11/site-packages/lxml/etree.py
# trying /usr/local/lib/python3.11/site-packages/lxml/etree.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'etree' from 'lxml' (/usr/local/lib/python3.11/site-packages/lxml/__init__.py)
Directory listing:
root@4a72c1b8f220:/# ls -la /usr/local/lib/python3.11/site-packages/lxml/etree*
-rwxr-xr-x 1 root root 9669656 Nov 11 15:11 /usr/local/lib/python3.11/site-packages/lxml/etree.cpython-311-arm-linux-gnueabihf.so
-rw-r--r-- 1 root root 8575 Nov 11 15:11 /usr/local/lib/python3.11/site-packages/lxml/etree.h
-rw-r--r-- 1 root root 132415 Nov 11 15:11 /usr/local/lib/python3.11/site-packages/lxml/etree.pyx
-rw-r--r-- 1 root root 17851 Nov 11 15:11 /usr/local/lib/python3.11/site-packages/lxml/etree_api.h
I realized this is a problem in the python:3.11-slim-bullseye
docker image, as it's provided only as armel
.
It works on the host machine (armhf
):
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> print(etree)
<module 'lxml.etree' from '/home/user/teste/lib/python3.11/site-packages/lxml/etree.cpython-311-arm-linux-gnueabihf.so'>
We build for armhf only, as per the homepage:
Wheels provided support all Raspberry Pi models (as of October 2023). Our wheels are only supported under 32-bit (armhf) Raspberry Pi OS
Package name
lxml
Package version
4.9.3
PyPI URL
https://pypi.org/project/lxml/
piwheels URL
https://www.piwheels.org/project/lxml/
Python version
I am aware this is the issue tracker for a Python package index specifically for Raspberry Pi
I have checked for duplicate issues
I am the maintainer
More information
On Python 3.11 (bookworm), trying to import etree returns an error:
On Python 3.9 (bullseye) everything works as expected:
Tests were conducted on a Raspberry Pi 1 Model B, under Raspberry Pi OS.