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 and Python 3.x on x86 in a virtualenv under Windows 10.
Open your macOS terminal. Type “ pip install lxml ” without quotes and hit Enter . If it doesn't work, try "pip3 install lxml" or “ python -m pip install lxml “. Wait for the installation to terminate successfully.
Unless you are using a static binary distribution (e.g. from a Windows binary installer), lxml requires libxml2 and libxslt to be installed, in particular: libxml2 version 2.9. 2 or later.
I had this issue and realised that whilst I did have libxml2 installed, I didn't have the necessary development libraries required by the python package. Installing them solved the problem:
sudo apt-get install libxml2-dev libxslt1-dev sudo pip install lxml
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 3.9, use lxml‑4.5.2‑cp39‑cp39‑win32.whl
.
Download the file, and then install with:
pip install C:\path\to\downloaded\file\lxml‑4.5.2‑cp39‑cp39‑win32.whl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With