ISA-tools / mzml2isa

Parser to get meta information from mzML file and parse relevant information to a ISA-Tab structure
GNU General Public License v3.0
12 stars 6 forks source link

lxml in windows (pip install) #6

Closed althonos closed 7 years ago

althonos commented 7 years ago

Originally opened by @Tomnl on althonos/mzml2isa:

Tom: When installing mzml2isa on windows lxml has to be installed in a bit of strange way so is failing with pip install. The installation works fine if you first install lxml using the following command (takes a while though and requires 'Microsoft Visual C++' ):

set STATICBUILD=true && pip install lxml

Alternatively, lxml can be installed from the unofficial binaries , (probably the easiest approach)

More information: http://stackoverflow.com/questions/20460890/lxml-install-on-windows-7-using-pip-and-python-2-7 http://stackoverflow.com/questions/19548011/cannot-install-lxml-on-mac-os-x-10-9

C:\Users\tnl495>pip install mzml2isa
Collecting mzml2isa
  Using cached mzml2isa-0.4.25.tar.gz
Collecting lxml (from mzml2isa)
  Using cached lxml-3.6.3.tar.gz
Collecting pronto (from mzml2isa)
  Using cached pronto-0.3.3.tar.gz
Collecting chainmap (from mzml2isa)
  Downloading chainmap-1.0.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six in c:\python27\lib
\site-packages (from pronto->mzml2isa)
Installing collected packages: lxml, pronto, chainmap, mzml2isa
  Running setup.py install for lxml
    Complete output from command c:\python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\tnl495\\appdata\\local\\temp\\pip-build-cukyyy\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\tnl495\appdata\local\temp\pip-q4w9fi-record\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.6.3.
    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
    error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27

    ----------------------------------------
Command "c:\python27\python.exe -c "import setuptools, tokenize;__file__='c:\\us
ers\\tnl495\\appdata\\local\\temp\\pip-build-cukyyy\\lxml\\setup.py';exec(compil
e(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file
__, 'exec'))" install --record c:\users\tnl495\appdata\local\temp\pip-q4w9fi-rec
ord\install-record.txt --single-version-externally-managed --compile" failed wit
h error code 1 in c:\users\tnl495\appdata\local\temp\pip-build-cukyyy\lxml
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
althonos commented 7 years ago

As Tom discovered that setting STATICBUILD=true before calling pip would work with a computer with a C Compiler installed on it. Maybe (that's just an idea) changing values in os.environ in setup.py before calling the setup function will do the trick.

Tomnl commented 7 years ago

That might work. However, I would be happy to close the issue if we just mention in the documentation that, for Windows, lxml may have to be installed either using STATICBUILD=true or by just downloading the unofficial windows binaries.

althonos commented 7 years ago

Well, if the solution if just to add os.environ['STATICBUILD'] = 'true' at the beginning of setup.py, I think that would be easier for the users. But someone need to test that works all right.

Tomnl commented 7 years ago

True, I could set up an AppVeyor windows testing enviroment to test the package.

Tomnl commented 7 years ago

I think I have a straight forward way of getting to lxml to work on Windows. The lxml windows binaries are not available on the most recent version of lxml on PyPi. If we make sure the lxml version being installed is version lxml==3.6.0 it should install fine though.

@althonos: Can you see a problem with using this version of lxml?

althonos commented 7 years ago

Nope, i don't think I'm using the most advanced features in lxml :)

Tomnl commented 7 years ago

So... I have updated the setup so that the following version of lxml is installed:

Windows: lxml==3.6.0 Linux/Mac: Latest version (lxml==3.6.4)

This is because:

lxml==3.6.4 has the binaries for Linux (but not windows) lxml==3.6.0 has the binaries for Windows (but not Linux)

Unfortunately there are no binaries on PyPi for Windows for >= python 3.5. In this case, lxml has to be either built from source or installed using the unofficial binaries.

Anyway.... I am going to close this issue now, as I do not think we can do much more

blaqvirus commented 5 years ago

Help, I installed LXML and now im getting the following error: from .. import etree ImportError: cannot import name etree

Please assist