Pip install error missing 'libxml/xmlversion.h'

clue3434 picture clue3434 · Aug 12, 2016 · Viewed 20.9k times · Source

I need to install the python package xmlsec(https://pypi.python.org/pypi/xmlsec) and when I try running

pip install xmlsec

It gives me this error:

src\xmlsec\constants.c(266) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory

When I first researched this error I found numerous answers that it had to do with the installed lxml package. After trying:

pip install --upgrade lxml

It wasn't able to upgrade and so I uninstalled lxml and installed it again but there was an IO error. In the end I downloaded the lxml file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml and placed it in my python directory and installed it as the answer from this question did: Installing lxml, libxml2, libxslt on Windows 8.1

It uploaded successfully and when running pip upgrade, it says it is up to date.

The same error though still persists from trying to install xmlsec though with 'libxml/xmlversion.h' missing. Does anyone know what else can be the problem here?

Note: I'm using python 2.7 on windows

Answer

Hans Then picture Hans Then · Aug 12, 2016

You may need to install the header files for libxml and libxml-sec. You do not indicate which platform you are running on. If you run on ubuntu you need to sudo apt-get install libxml2-dev libxmlsec1-dev.