2

I have some problems with python 3 module installing. I'm trying to install python docx using pip :

pip install python-docx

for python 3.4 and here is the error I get:

 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 4

Here is the full message :

*C:\Python34>pip install python-docx
Collecting python-docx
  Using cached python-docx-0.8.6.tar.gz
Collecting lxml>=2.3.2 (from python-docx)
  Using cached lxml-3.6.4.tar.gz
Installing collected packages: lxml, python-docx
  Running setup.py install for lxml ... error
    Complete output from command "c:\users\sultan ahmed\appdata\local\programs\python\python35-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\SULTAN~1\\AppData\\Local\\Temp\\pip-build-9px1syzb\\lxml\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SULTAN~1\AppData\Local\Temp\pip-ea3o7pxk-record\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.6.4.
    Building without Cython.
    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
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.5
    creating build\lib.win32-3.5\lxml
    copying src\lxml\builder.py -> build\lib.win32-3.5\lxml
    copying src\lxml\cssselect.py -> build\lib.win32-3.5\lxml
    copying src\lxml\doctestcompare.py -> build\lib.win32-3.5\lxml
    copying src\lxml\ElementInclude.py -> build\lib.win32-3.5\lxml
    copying src\lxml\pyclasslookup.py -> build\lib.win32-3.5\lxml
    copying src\lxml\sax.py -> build\lib.win32-3.5\lxml
    copying src\lxml\usedoctest.py -> build\lib.win32-3.5\lxml
    copying src\lxml\_elementpath.py -> build\lib.win32-3.5\lxml
    copying src\lxml\__init__.py -> build\lib.win32-3.5\lxml
    creating build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\__init__.py -> build\lib.win32-3.5\lxml\includes
    creating build\lib.win32-3.5\lxml\html
    copying src\lxml\html\builder.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\clean.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\defs.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\diff.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\ElementSoup.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\formfill.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\html5parser.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\soupparser.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\usedoctest.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_diffcommand.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_html5builder.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_setmixin.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\__init__.py -> build\lib.win32-3.5\lxml\html
    creating build\lib.win32-3.5\lxml\isoschematron
    copying src\lxml\isoschematron\__init__.py -> build\lib.win32-3.5\lxml\isoschematron
    copying src\lxml\lxml.etree.h -> build\lib.win32-3.5\lxml
    copying src\lxml\lxml.etree_api.h -> build\lib.win32-3.5\lxml
    copying src\lxml\includes\c14n.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\config.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\relaxng.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\schematron.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\tree.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\uri.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xinclude.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xpath.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xslt.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\etree_defs.h -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.5\lxml\includes
    creating build\lib.win32-3.5\lxml\isoschematron\resources
    creating build\lib.win32-3.5\lxml\isoschematron\resources\rng
    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-3.5\lxml\isoschematron\resources\rng
    creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build\temp.win32-3.5
    creating build\temp.win32-3.5\Release
    creating build\temp.win32-3.5\Release\src
    creating build\temp.win32-3.5\Release\src\lxml
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Isrc\lxml\includes "-Ic:\users\sultan ahmed\appdata\local\programs\python\python35-32\include" "-Ic:\users\sultan ahmed\appdata\local\programs\python\python35-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\atl\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\mfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\include" /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win32-3.5\Release\src\lxml\lxml.etree.obj -w
    fatal error C1510: Cannot load language resource clui.dll.
    Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 4
    creating Users
    creating Users\SULTAN~1
    creating Users\SULTAN~1\AppData
    creating Users\SULTAN~1\AppData\Local
    creating Users\SULTAN~1\AppData\Local\Temp
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\atl\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\mfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\include" /TcC:\Users\SULTAN~1\AppData\Local\Temp\xmlXPathInitjiyz_drd.c /FoUsers\SULTAN~1\AppData\Local\Temp\xmlXPathInitjiyz_drd.obj
    fatal error C1510: Cannot load language resource clui.dll.
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 4

    ----------------------------------------
Command ""c:\users\sultan ahmed\appdata\local\programs\python\python35-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\SULTAN~1\\AppData\\Local\\Temp\\pip-build-9px1syzb\\lxml\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SULTAN~1\AppData\Local\Temp\pip-ea3o7pxk-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SULTAN~1\AppData\Local\Temp\pip-build-9px1syzb\lxml\*

I had other problems with module installation before, and I solved those by installing Visual Studio C++ 2010

Btw, the installation of other modules are working just fine.

My specs : Windows 10 x64

Python 3.4

1 Answer 1

4

The quickest way around this is installing lxml from a binary installer.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

It looks like the Visual Studio C compiler can't find the libxml2 and/or libxslt C libraries, which is a common problem preventing lxml from installing as it depends on both of those.

If you really wanted to build it from source, that's the direction you'd want to pursue next, confirming the installation of those two C libraries. But most folks just install lxml from the binary.

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

2 Comments

I was having the same issue (except "Exit status 2" instead of 4), and this worked fast for me. Thanks. Note to others: make sure you get the lxml wheel that matches your python bit version (32 or 64), or else you'll get an error saying that the wheel was not supported on that platform.
@J.Saw I've heard that the default Python install on Windows is 32-bit, even on 64-bit Windows. So that makes your advice that much the more important :) I believe executing this little bit of code at the Python command-prompt reliably tells you which you have installed: import struct;print struct.calcsize("P") * 8, printing either 32 or 64 depending.

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.