Getting "Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?" when installing lxml through pip

I'm getting an error Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? when trying to install lxml through pip.

      c:\users\f\appdata\local\temp\xmlXPathInitqjzysz.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      error: command 'C:\\Users\\f\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

I don't find any libxml2 dev packages to install via pip.

Using Python 2.7.10 on x86 in a virtualenv under Windows 10.

Install lxml from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml for your python version. It's a precompiled WHL with required modules/dependencies.

The site lists several packages, when e.g. using Win32 Python 2.7, use lxml-3.6.1-cp27-cp27m-win32.whl.

Download the file, and then install with

    pip install C:\path\to\downloaded\file\lxml-3.6.1-cp27-cp27m-win32.whl

From: stackoverflow.com/q/33785755

Back to homepage or read more recommendations: