myint / language-check

Python wrapper for LanguageTool grammar checker
https://pypi.python.org/pypi/language-check
GNU Lesser General Public License v3.0
326 stars 102 forks source link

Install failing with certain java version #31

Open Makman2 opened 7 years ago

Makman2 commented 7 years ago

Our build system Travis has problems to install language-check:

----------------------------------------
  Failed building wheel for language-check
  Running setup.py clean for language-check
Failed to build language-check
Installing collected packages: language-check, munkres3, mypy-lang, jsonschema, decorator, ipython-genutils, enum34, traitlets, jupyter-core, nbformat, nltk, click, future, proselint, pycodestyle, pydocstyle, lazy-object-proxy, wrapt, astroid, mccabe, pylint, mando, colorama, radon, restructuredtext-lint, rstcheck, pyparsing, packaging, safety, scspell3k, pathlib, chardet, ansicolor, vim-vint, vulture, yamllint, yapf
  Running setup.py install for language-check ... error
    Complete output from command /home/travis/virtualenv/python3.3.6/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-x7h2r3/language-check/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-u9p7qy-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python3.3.6/include/site/python3.3/language-check:
    Could not parse Java version from """java version "9-ea"
    Java(TM) SE Runtime Environment (build 9-ea+140)
    Java HotSpot(TM) 64-Bit Server VM (build 9-ea+140, mixed mode)
    """.

    ----------------------------------------
Command "/home/travis/virtualenv/python3.3.6/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-x7h2r3/language-check/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-u9p7qy-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python3.3.6/include/site/python3.3/language-check" failed with error code 1 in /tmp/pip-build-x7h2r3/language-check/
nemani commented 7 years ago

The error is here. The java version on our ci is

java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+140)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+140, mixed mode)

We need to change the regex.

jayvdb commented 7 years ago

Note this was worked around on the coala builds by changing Java versions https://github.com/coala/coala-bears/pull/1279 .

Re-adding package oracle-java9-set-default may reproduce the bug. If it doesnt re-occur using oracle-java9-set-default, maybe the problem was an unusual version that was fixed upstream.

yzgyyang commented 6 years ago

I am having a similar error on macOS with javac 10.0.1.

(env) ➜  ~ pip install language-check
Collecting language-check
  Using cached https://files.pythonhosted.org/packages/97/45/0fd1d3683d6129f30fa09143fa383cdf6dff8bc0d1648f2cf156109cb772/language-check-1.1.tar.gz
Building wheels for collected packages: language-check
  Running setup.py bdist_wheel for language-check ... error
  Complete output from command /Users/guangyuan/env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/40/6gx9xcqj6q3_1t9tp5c4pxg80000gn/T/pip-install-tb8rwnmd/language-check/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 /private/var/folders/40/6gx9xcqj6q3_1t9tp5c4pxg80000gn/T/pip-wheel-tjdi998h --python-tag cp37:
  Could not parse Java version from """java version "10.0.1" 2018-04-17
  Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
  Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
  """.

  ----------------------------------------
  Failed building wheel for language-check
  Running setup.py clean for language-check
Failed to build language-check
Installing collected packages: language-check
  Running setup.py install for language-check ... error
    Complete output from command /Users/guangyuan/env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/40/6gx9xcqj6q3_1t9tp5c4pxg80000gn/T/pip-install-tb8rwnmd/language-check/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/40/6gx9xcqj6q3_1t9tp5c4pxg80000gn/T/pip-record-b95928al/install-record.txt --single-version-externally-managed --compile --install-headers /Users/guangyuan/env/bin/../include/site/python3.7/language-check:
    Could not parse Java version from """java version "10.0.1" 2018-04-17
    Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
    Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
    """.
jayvdb commented 6 years ago

@yzgyyang can you try to patch it?

lingdoc commented 5 years ago

A workaround that I found:

install Open JDK Java 8 with brew using brew cask install homebrew/cask-versions/adoptopenjdk8 (see https://github.com/Homebrew/homebrew-cask-versions/issues/7253#issuecomment-484672949)

install Jenv with brew using brew install jenv and set your global java environment to use java8 (see https://medium.com/@brunofrascino/working-with-multiple-java-versions-in-macos-9a9c4f15615a and https://github.com/jenv/jenv/issues/167#issuecomment-455164044 to figure out how to do this)

with Python 3.6 or higher, you may need to run the Install certificates.command found at Applications/Python 3.6/ before running pip install language-check - otherwise the installer may fail due to SSL certificate problems when trying to download dependencies.

aladagemre commented 5 years ago

I get a similar error:

Could not parse Java version from """openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment (build 12.0.1+12)
OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
"""
myidanurag commented 4 years ago

I am also facing the issue while installing the language-check.

Building wheel for language-check (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rlzr4jfe/language-check/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rlzr4jfe/language-check/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 /tmp/pip-wheel-qm_z_qs_ --python-tag cp36
       cwd: /tmp/pip-install-rlzr4jfe/language-check/
  Complete output (4 lines):
  Could not parse Java version from """openjdk version "11.0.4" 2019-07-16
  OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
  OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
  """.
  ----------------------------------------
  ERROR: Failed building wheel for language-check
myidanurag commented 4 years ago

Hi, I found the issue and solved it by taking following steps:

  1. If you are using ubuntu image, then by default, it installs jdk11.
  2. I think, language-check is not compatible with jdk8
  3. I removed the default-jdk from my docker file and added commands for installing jdk8.
  4. This solved the problem for me.

Commands which I added in docker file are as follows:

#Installing openjdk-8
RUN apt-get update && \
    apt-get install -y openjdk-8-jdk && \
    apt-get install -y ant && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /var/cache/oracle-jdk8-installer;

RUN apt-get update && \
    apt-get install -y ca-certificates-java && \
    apt-get clean && \
    update-ca-certificates -f && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /var/cache/oracle-jdk8-installer;

# Setup JAVA_HOME, this is useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
jxmorris12 commented 4 years ago

Hi! Since this project has been abandoned, I started a new fork over at https://github.com/jxmorris12/language_tool_python.

My version supports new versions of Java and LanguageTool. language-check is stuck on Java 8 and LanguageTool 3.2; latest versions are Java 14 and LanguageTool 4.9!

I'm happy to help you with your issue if you raise it over at my repository! Thanks!