Search code examples
pythonbuildpiplxmlsalt-project

How do I add an include path when pip installing lxml on Centos7 using Salt?


I'm trying to install lxml for Python 3.4 on Centos7.

I have a Salt state that looks like this:

lxml:
  pip.installed:
    - bin_env: /opt/rh/rh-python34/root/bin/pip3
    - env_vars:
        INCLUDE: /usr/include/libxml2

But that doesn't work. With or without the env_vars, I get this error:

src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory

So what environment variable do I have to add to get the build to actually see my xmlversion.h? It definitely exists:

# salt 'myminion' file.readdir /usr/include/libxml2/libxml | grep version
    - xmlversion.h

Solution

  • If you have the xml dev packages installed already, can you please try a symlink like sudo ln -s libxml2/libxml libxml as noted here: src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory