3

I am attempting to install the latest lxml module in a virtualenv with Python3.4 on Windows 7. As a long time Linux user, this process should be simple, but, of course, it's not. I'm trying to install the latest lxml, and there is currently no package that works with Python3.4+ Consequently, I acquired libxml2 and libxslt, but I cannot seem to get anything to recognize them. Can anyone point me in the right direction of linking everything together.

I've tired pretty much everything from http://lxml.de/build.html and all the variants I can think of. Any help would be much appreciated.

Error logs below:

Building lxml version 3.4.1.
Building with Cython 0.21.1.
ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt
missing cimport in module 'lxml.includes': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml.includes.tree': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml.python': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml.includes': src\lxml\lxml.objectify.pyx
missing cimport in module 'lxml.includes.etreepublic': src\lxml\lxml.objectify.pyx
missing cimport in module 'lxml.includes.tree': src\lxml\lxml.objectify.pyx
missing cimport in module 'lxml': src\lxml\lxml.objectify.pyx
C:\Python34\Lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
running build
running build_py
copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.4\lxml\includes
running build_ext
building 'lxml.etree' extension
C:\minGW\bin\gcc.exe -mdll -O -Wall -IC:\Users\username\Desktop\angelScripts\draft\lxml-master\src\lxml\includes -IC:\Pyth
on34\include -IC:\Python34\include -c src\lxml\lxml.etree.c -o build\temp.win32-3.4\Release\src\lxml\lxml.etree.o -w
In file included from src\lxml\lxml.etree.c:239:0:
C:\Users\username\Desktop\angelScripts\draft\lxml-master\src\lxml\includes/etree_defs.h:14:31: fatal error: libxml/xmlvers
ion.h: No such file or directory
 #include "libxml/xmlversion.h"
                               ^
compilation terminated.
error: command 'C:\\minGW\\bin\\gcc.exe' failed with exit status 1

3 Answers 3

3

I downloaded lxml-3.4.4-cp34-none-win_amd64.whl from Christoph's Gohlke's Python page and install it using

pip install lxml-3.4.4-cp34-none-win_amd64.whl 

it worked for me.

2

I'd recommend downloading lxml from Christoph Gohlke's Python Extension Packages for Windows Repository. Select either lxml‑3.4.1.win‑amd64‑py3.4.exe or lxml‑3.4.1.win32‑py3.4.exe, depending on whether you're running a 64- or 32-bit Python installation, respectively. Don't run the installer, but instead unzip it. Move the contents of the resulting PLATLIB folder (an lxml directory, and an lxml-3.4.1-py3.4.egg-info directory) to the site-packages folder in your virtualenv, and you should be all set.

0
2

I've just had this problem, and here's how I solved it:

First try to pip install it. Go to command prompt and type in C:/Python34/Scripts/pip install lxml

If you still got an error, than go to Christoph's Gohlke's Python page

and then download the right lxml. Generally since I use python 3.4 and I have a windows, I download the lxml-3.4.4-cp34-none-win32.whl

Now that you have a whl file, go to the folder it is in. Click in the background (so nothing is selected), then leftshift + rightclick at the same time and click on open command window. Then type C:/Python34/Scripts/pip install "NAME OF THE FILE YOU JUST DOWNLOADED.whl"

and press enter. This worked well for me, and after you type the quote you can also press tab and it should fill the right one for you.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.