Unable to install python-docx

15,669

Solution 1

This is a problem with the lxml install. If you install lxml separately, using a Windows binary package, then reinstall python-docx, this error should go away.

You can find a binary lxml package here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

Solution 2

I had the same issue. I was not able to install the lxml wheel for 64 machine because python falsely identifies my computer as 32. Ultimately installed the 32 and then it installed python-docx successfully. FYI: I would have added this to comments but I don’t have the 50 required reputation to do so.

Share:
15,669
Ree
Author by

Ree

Updated on June 14, 2022

Comments

  • Ree
    Ree about 2 years

    I need to create table in a Word document through Python 3.4. For that, I am trying to install python-docx in Windows. If I use pip install python-docx I am getting the following error:

    vcvarsall.bat error
    

    So I installed Visual Studio and then tried to install it and I am still getting the following :

    error: Setup script exited with error: command '"C:\Program Files (x86)\Microsoft Visual
    Studio 10.0\VC\BIN\cl.exe"' failed with exit status 2
    
    • nneonneo
      nneonneo over 9 years
      ...any other error messages? Have you tried to find a prebuilt version for your OS?
    • Ree
      Ree over 9 years
      No.. how is that ? Any other option to print the output in table format using python 3.4 ?
    • jpmc26
      jpmc26 over 9 years
      vcvarsall.bat is a Microsoft C++ compiler. The error means that setuptools can't find a compiler installed on your machine. Normally, I find a Windows binary and use this command, but without an existing Windows binary, you might have to build from source yourself.
    • jpmc26
      jpmc26 over 9 years
      Hang on. It looks like the native dependency might be lxml. If so, the error comes from installing lxml, not python-docx. What happens if you install lxml from here using the command I mentioned above before installing python-docx?
    • Martijn Pieters
      Martijn Pieters over 9 years
  • scanny
    scanny over 9 years
    Since this worked for you, please accept the answer and click the up-arrow to endorse it if it was a help :)
  • Benjamin
    Benjamin about 4 years
    When trying to install either the 32-bit or the 64-bit version of the .whl files with pip in Windows 10 I get an error message saying that the .whl is not a supported wheel on this platform.