How to install lxml in Rocky Linux 8

To install lxml, follow below steps

  1. dnf install libxml2-devel
  2. dnf install libxslt-devel
  3. pip3 install lxml

Note: the installation of packages requires admin access, but the pip3 install should be run as regular user and destination directory be such that the regular account can write to. This is to prevent the pip from adding or modifying files in system directories that the package manager (dnf) assumes to be all from packages.