0

I'm trying to run the following command in command prompt -

pip install -r requirements.txt

But it shows so many errors and I have no idea how to resolve them as I'm not familiar with python.

The errors are: 1.

Collecting lxml==3.5.0 (from -r requirements.txt (line 1))
  Using cached lxml-3.5.0.tar.gz
Collecting pyquery==1.2.10 (from -r requirements.txt (line 2))
Collecting cssselect>0.7.9 (from pyquery==1.2.10->-r requirements.txt (line 2))




     Using cached cssselect-1.0.1-py2.py3-none-any.whl
        Building wheels for collected packages: lxml
          Running setup.py bdist_wheel for lxml ... error
          Complete output from command c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Mohana\\AppData\\Local\\Temp\\pip-build-9bz1xoev\\lxml\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Mohana\AppData\Local\Temp\tmp425xg1fhpip-wheel- --python-tag cp34:
          Building lxml version 3.5.0.
          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 **

2. 

    src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2
      creating Users
      creating Users\Mohana
      creating Users\Mohana\AppData
      creating Users\Mohana\AppData\Local
      creating Users\Mohana\AppData\Local\Temp
      C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /TcC:\Users\Mohana\AppData\Local\Temp\xmlXPathInitocb5oi7w.c /FoUsers\Mohana\AppData\Local\Temp\xmlXPathInitocb5oi7w.obj
      xmlXPathInitocb5oi7w.c
      C:\Users\Mohana\AppData\Local\Temp\xmlXPathInitocb5oi7w.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:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2

3.

Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, cssselect, pyquery
  Found existing installation: lxml 4.0.0
    Uninstalling lxml-4.0.0:
      Successfully uninstalled lxml-4.0.0
  Running setup.py install for lxml ... error
    Complete output from command c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Mohana\\AppData\\Local\\Temp\\pip-build-9bz1xoev\\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\Mohana\AppData\Local\Temp\pip-rjvm3d2l-record\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.5.0.
    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 **


4. 

    src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
        Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /TcC:\Users\Mohana\AppData\Local\Temp\xmlXPathInity8a5suic.c /FoUsers\Mohana\AppData\Local\Temp\xmlXPathInity8a5suic.obj
        xmlXPathInity8a5suic.c
        C:\Users\Mohana\AppData\Local\Temp\xmlXPathInity8a5suic.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:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2

Please help me solve these issues, I need it for a project and I really need to get it done. I am on Windows 10 (Intel processors) and Python3.4.

Martin Alonso
  • 726
  • 2
  • 9
  • 16
The doctor
  • 29
  • 1
  • 8
  • 1
    Possible duplicate of [How to install lxml on Windows](https://stackoverflow.com/questions/29440482/how-to-install-lxml-on-windows) – Tomalak Oct 16 '17 at 22:07

3 Answers3

1

As @SaeX says in this answer, you can find the precompiled WHL of lxml with the required modules and dependencies here.

For Python 3.4 and win10 your file should be lxml‑4.1.0‑cp34‑cp34m‑win_amd64.whl. Then you can install it by using pip:

pip install lxml‑4.1.0‑cp34‑cp34m‑win_amd64.whl

Martin Alonso
  • 726
  • 2
  • 9
  • 16
0

For python 3.4 or above,

In command Prompt, type pip3 install lxml in case if you want to download and install from network automatically otheriwse, download .whl file of lxml from the below

For 32 bit : Download Here

For 64 bit : Download Here

After downloading the wheel file,navigate your command prompt to the location where the .whl file is downloaded and then try pip3 install "downloaded whl file name"

Rajesh_Saladi
  • 131
  • 1
  • 4
0

For windows, you can install lxml by exe file if also failed by whl. You can download it from lxml

Hope this can help you.

Zik
  • 202
  • 3
  • 11