datamade / parserator

:bookmark: A toolkit for making domain-specific probabilistic parsers
http://parserator.datamade.us
MIT License
797 stars 82 forks source link

Can't Install #31

Closed paulds8 closed 7 years ago

paulds8 commented 8 years ago

Hi there.. I was hoping someone could help me with this issue. I'm not able to install parserator. I know this isn't necessarily a parserator issue, but it would be really helpful to provide some assistance with this.

My intention is to build an address parser for South Africa.

This the error that comes back.

C:\WINDOWS\system32>"C:\Python27\ArcGIS10.4\python.exe" -m pip install parserator
Collecting parserator
  Using cached parserator-0.6.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): future>=0.14.3 in c:\python27\arcgis10.4\lib\site-packages (from parserator)
Collecting lxml>=3.4.1 (from parserator)
  Using cached lxml-3.6.4.tar.gz
Requirement already satisfied (use --upgrade to upgrade): python-crfsuite>=0.7 in c:\python27\arcgis10.4\lib\site-packages (from parserator)
Collecting backports.csv (from parserator)
  Using cached backports.csv-1.0.2-py2.py3-none-any.whl
Installing collected packages: lxml, backports.csv, parserator
  Running setup.py install for lxml ... error
    Complete output from command C:\Python27\ArcGIS10.4\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pdossa~1\\appdata\\local\\temp\\pip-build-vvxc68\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\pdossa~1\appdata\local\temp\pip-g_btwd-record\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.6.4.
    Building without Cython.
    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
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    creating build\lib.win32-2.7\lxml
    copying src\lxml\builder.py -> build\lib.win32-2.7\lxml
    copying src\lxml\cssselect.py -> build\lib.win32-2.7\lxml
    copying src\lxml\doctestcompare.py -> build\lib.win32-2.7\lxml
    copying src\lxml\ElementInclude.py -> build\lib.win32-2.7\lxml
    copying src\lxml\pyclasslookup.py -> build\lib.win32-2.7\lxml
    copying src\lxml\sax.py -> build\lib.win32-2.7\lxml
    copying src\lxml\usedoctest.py -> build\lib.win32-2.7\lxml
    copying src\lxml\_elementpath.py -> build\lib.win32-2.7\lxml
    copying src\lxml\__init__.py -> build\lib.win32-2.7\lxml
    creating build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\__init__.py -> build\lib.win32-2.7\lxml\includes
    creating build\lib.win32-2.7\lxml\html
    copying src\lxml\html\builder.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\clean.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\defs.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\diff.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\ElementSoup.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\formfill.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\html5parser.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\soupparser.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\usedoctest.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\_diffcommand.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\_html5builder.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\_setmixin.py -> build\lib.win32-2.7\lxml\html
    copying src\lxml\html\__init__.py -> build\lib.win32-2.7\lxml\html
    creating build\lib.win32-2.7\lxml\isoschematron
    copying src\lxml\isoschematron\__init__.py -> build\lib.win32-2.7\lxml\isoschematron
    copying src\lxml\lxml.etree.h -> build\lib.win32-2.7\lxml
    copying src\lxml\lxml.etree_api.h -> build\lib.win32-2.7\lxml
    copying src\lxml\includes\c14n.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\config.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\relaxng.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\schematron.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\tree.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\uri.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\xinclude.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\xpath.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\xslt.pxd -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\etree_defs.h -> build\lib.win32-2.7\lxml\includes
    copying src\lxml\includes\lxml-version.h -> build\lib.win32-2.7\lxml\includes
    creating build\lib.win32-2.7\lxml\isoschematron\resources
    creating build\lib.win32-2.7\lxml\isoschematron\resources\rng
    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-2.7\lxml\isoschematron\resources\rng
    creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl
    creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-2.7\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-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\src
    creating build\temp.win32-2.7\Release\src\lxml
    C:\Users\pdossantos\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc\lxml\includes -IC:\Python27\ArcGIS10.4\include -IC:\Python27\ArcGIS10.4\PC /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win32-2.7\Release\src\lxml\lxml.etree.obj -w
    cl : Command line warning D9025 : overriding '/W3' with '/w'
    lxml.etree.c
    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:\\Users\\pdossantos\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
    creating users
    creating users\pdossa~1
    creating users\pdossa~1\appdata
    creating users\pdossa~1\appdata\local
    creating users\pdossa~1\appdata\local\temp
    C:\Users\pdossantos\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /Tcc:\users\pdossa~1\appdata\local\temp\xmlXPathInitxf8h0v.c /Fousers\pdossa~1\appdata\local\temp\xmlXPathInitxf8h0v.obj
    xmlXPathInitxf8h0v.c
    c:\users\pdossa~1\appdata\local\temp\xmlXPathInitxf8h0v.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:\\Users\\pdossantos\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Python27\ArcGIS10.4\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pdossa~1\\appdata\\local\\temp\\pip-build-vvxc68\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\pdossa~1\appdata\local\temp\pip-g_btwd-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\pdossa~1\appdata\local\temp\pip-build-vvxc68\lxml\
afbrogneaux commented 7 years ago

Hi,

Here is how I managed to solve this issue on Windows 10.

First, download the lxml binding for Windows: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml In the file name, cpXY stands for the Python version (cp27 is for Python 2.7, cp34 is for Python 3.4, etc.).

Then, in a virtual env (here "venv"), install lxml with pip install.

Verify that wheel is installed (optional):

(venv) C:\Users\afb>pip install wheel
Requirement already satisfied: wheel in c:\users\afb\venv\lib\site-packages

Install the previously downloaded file:

(venv) C:\Users\afb>pip install c:\Users\afb\lxml-3.7.0-cp27-cp27m-win32.whl
Processing c:\users\afb\lxml-3.7.0-cp27-cp27m-win32.whl
Installing collected packages: lxml
Successfully installed lxml-3.7.0

And, finally, you can install parserator:

(venv) C:\Users\afb>pip install parserator
Collecting parserator
Collecting backports.csv (from parserator)
  Using cached backports.csv-1.0.2-py2.py3-none-any.whl
Collecting future>=0.14.3 (from parserator)
Collecting python-crfsuite>=0.7 (from parserator)
Requirement already satisfied: lxml>=3.4.1 in c:\users\afb\venv\lib\site-packages (from parserator)
Installing collected packages: backports.csv, future, python-crfsuite, parserator
Successfully installed backports.csv-1.0.2 future-0.16.0 parserator-0.6.2 python-crfsuite-0.9

Hope it helps.

jeancochrane commented 7 years ago

Sorry for the late replies on this, @afbrogneaux @paulds8! We don't have any Windows users on our end, so this kind of error report is helpful.

Out of curiosity, are you able to install it now via pypi without doing the manual install of lxml? Looking at the lxml package index, it seems like they stopped providing 2.7/Windows builds after 3.6.0, which may have been messing things up. It looks like @fgregg pinned our required version of lxml to 3.6.0 about a month ago, so this may be fixed.

afbrogneaux commented 7 years ago

It seems fixed for me (venv is a brand new virtual environment):

(venv) C:\Users\afb>pip install parserator
Collecting parserator
  Downloading parserator-0.6.4-py2-none-any.whl
Collecting backports.csv (from parserator)
  Using cached backports.csv-1.0.2-py2.py3-none-any.whl
Collecting future>=0.14.3 (from parserator)
Collecting python-crfsuite>=0.7 (from parserator)
  Downloading python_crfsuite-0.9.1-cp27-cp27m-win32.whl (113kB)
    100% |################################| 122kB 1.1MB/s
Collecting lxml==3.6.0 (from parserator)
  Downloading lxml-3.6.0-cp27-none-win32.whl (3.0MB)
    100% |################################| 3.1MB 347kB/s
Installing collected packages: backports.csv, future, python-crfsuite, lxml, parserator
Successfully installed backports.csv-1.0.2 future-0.16.0 lxml-3.6.0 parserator-0.6.4 python-crfsuite-0.9.1

Thanks!