pip install fails to find "libxml/xmlreader.h"

Solution Verified - Updated -

Issue

  • pip install of a package fails with error such as:
fatal error: libxml/xmlreader.h: No such file or directory
       20 | #include <libxml/xmlreader.h>
          |          ^~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------

Environment

  • Red Hat Enterprise Linux 9
  • Python 3 package installing via pip
  • Python package which depends on system libxml2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content