19

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

Community
  • 1
  • 1
clue3434
  • 215
  • 1
  • 2
  • 8
  • can you search for the file `xmlversion.h` on your machine? On my Ubuntu it is at `/usr/include/libxml2/libxml`, but I'm guessing you are using Windows 8.1 – rivu Aug 12 '16 at 01:15
  • Installing a python distribution instead of the python interpreter alone is a good idea if you are on Windows. [Anaconda](https://www.continuum.io/downloads), for example, should take care of installing all lxml dependencies so you don't have to worry about it. – Daniel Aug 12 '16 at 09:08

1 Answers1

40

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.

Hans Then
  • 10,935
  • 3
  • 32
  • 51