About once every 1-2 years I make several failed attempts to install Python’s
lxml module, only to intuit from the compiler errors and/or Google and/or Stack Exchange that I am missing the same C dependencies again (most recently on my Ubuntu phone).
So, next time, run this first:
sudo apt install -y python3-dev libxml2 libxml2-dev libxslt1-dev
You’re welcome, future me. (And, coincidentally, anybody who has the same problem and happened to find this note).