33

I am attempting to install libxml2 so that I can setup the python bindings and eventually use lxml.

However I am unable to work out here on earth I am supposed to be unzipping the files. I haven't been able to google successfully.

Do I need Cygwin/MinGW for the installation to be successful?

At the moment I have the files from the libxml2.tar.gz and libxslt.tar.gz in their respective directories within my Python folder. So files that were in the tars under include are in Python26\include\libxml2\libxml... and so on.

however when i run a easy_install lxml i receive the following output:

Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.2.4
Downloading http://codespeak.net/lxml/lxml-2.2.4.tgz
Processing lxml-2.2.4.tgz
Running lxml-2.2.4\setup.py -q bdist_egg --dist-dir c:\users\rocco\appdata\local
\temp\easy_install-1xwbhy\lxml-2.2.4\egg-dist-tmp-9zwhe4
Building lxml version 2.2.4.
NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' need
s to be available.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt
warning: no files found matching 'lxml.etree.c' under directory 'src\lxml'
warning: no files found matching 'lxml.objectify.c' under directory 'src\lxml'
warning: no files found matching 'lxml.etree.h' under directory 'src\lxml'
warning: no files found matching 'lxml.etree_api.h' under directory 'src\lxml'
warning: no files found matching 'etree_defs.h' under directory 'src\lxml'
warning: no files found matching 'pubkey.asc' under directory 'doc'
warning: no files found matching 'tagpython*.png' under directory 'doc'
error: Setup script exited with error: Unable to find vcvarsall.bat

Any help whatsoever would be very helpful as I've been trying to get this going for over a week now :(

Thanks

2
  • I've got the same problem, trying to install lxml 2.2.6 (I also tried 2.2.4 and 2.2.5). Irritatingly, I had to resort to using the prebuilt library for 2.2.2 as suggested by S.Mark below. It would be great if someone could compile the 2.2.6 version for Python 2.6 (there's a 2.4 and 2.5 build, after all) :/ Commented May 21, 2010 at 2:33
  • 1
    Answer to this question: stackoverflow.com/questions/3047542/#5122521 Commented Feb 25, 2011 at 21:06

5 Answers 5

34

The Windows binaries of the latest version of lxml (as well as a wide range of other Python packages) are available on http://www.lfd.uci.edu/~gohlke/pythonlibs/

Sign up to request clarification or add additional context in comments.

4 Comments

+1: binary for Python 2.7 is available at this site but not at pypi
it says 32 and 64. So I downloaded a 64, then it says :lxml-3.6.4-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform. So I installed the 32 one. and it works!
Oh my god man. Thank you. So much. Have been banging my head against this for like an hour.
@Tiina same here, not sure why
27

If you don't have special reasons to compile from source, you can use prebuilt binaries for lxml

4 Comments

Why is that when I try to do a pip install lxml or an easy_install lxml it tries building from source? Can I make pip download the pre -built binaries?
@Mridang easy_install URL_TO_EGG to install the prebuilt binaries. Get the correct url on the pypi page or another site: pypi.python.org/pypi/lxml/2.2.2
If trying to install for Python 3.5 or 3.6, check @chuckus answer below!
sadly there are no prebuilt for arm :(
3

If you are using python 2.5.x, just use "easy_install lxml==2.2.2" to install

Comments

3

Realize this is an old topic but have had issues installing this on windows.

I have Python version 3.4.4.

When attempting to install whl files make sure you are using the correct version for your version of python.

so in this case i needed to use

lxml‑3.4.4‑cp34‑none‑win_amd64.whl

and not the latest which was

lxml‑3.4.4‑cp35‑none‑win_amd64.whl

cp34 indicates the python version its built for.

Trap for new players...!

Comments

0

It appears that the program "xslt-config" is not located in a directory in your PATH environment. Here's an article on setting PATH on Windows:

http://www.cs.usask.ca/~wew036/latex/env.html

1 Comment

It's not simply a PATH problem: xslt-config is missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.