Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jre has value 1.8 but 1.7 required and then CoreNLP needs 1.8+ #17

Open
ccrowner opened this issue Sep 29, 2015 · 9 comments
Open

jre has value 1.8 but 1.7 required and then CoreNLP needs 1.8+ #17

ccrowner opened this issue Sep 29, 2015 · 9 comments

Comments

@ccrowner
Copy link

edited registry to 1.7 then got

JavaRuntimeVersionError too old must use 1.8+ for CoreNLP

I am using the jar_filename parameter to point to the recent stanford-parser.jar

Thanks!

@dmcc
Copy link
Owner

dmcc commented Sep 30, 2015

Thanks for the report. Can you explain what you mean by "1.7 required" and "edited registry to 1.7"? Also, which version of the JRE is actually installed?

@ccrowner
Copy link
Author

I have both jre 1.7 and 1.8 installed

when PyStanfordDependencies threw the JavaVersionError "jre has value 1.8
but 1.7 required" I edited the Windows registry to jre version 1.7

that worked with respect to PyStanfordDependencies BUT led to an error in
CoreNLP (the most recent version) which requires 1.8 (hence throws the
error "CoreNLP needs 1.8+")

thanks

BTW your tool promises to be very useful, all the Python wrappers on the
StanfordNLP site only run under Unix and though NLTK enables many of the
StanfordNLP components they don't wrap the DependencyParser

On Wed, Sep 30, 2015 at 10:29 AM, David McClosky [email protected]
wrote:

Thanks for the report. Can you explain what you mean by "1.7 required" and
"edited registry to 1.7"? Also, which version of the JRE is actually
installed?


Reply to this email directly or view it on GitHub
#17 (comment)
.

@dmcc
Copy link
Owner

dmcc commented Sep 30, 2015

Can you send the full stacktrace for the "jre has value 1.8 but 1.7 required" error?

PyStanfordDependencies on its own doesn't care about the JRE versions, it just tries to detect when the jars require a different version. Are you using subprocess or JPype for your backend? (maybe JPype needs JRE 1.7 on Windows?).

@ccrowner
Copy link
Author

OK - the program I run is stanford_dependencies_test.py (attached)

If I have jre 1.8 set in the registry

  • note: the JAVA_HOME settings don't take, as well as the Control Panel
    Java settings, going to Registry does

http://stackoverflow.com/questions/26324486/properly-installing-java-8-along-with-java-7

I get dependencies_error.txt

When I set the jre to 1.7 in the registry I get dependencies_error3.txt

Thanks for looking at this. You can see I print out the command you execute
and have fiddled around with your code but got nowhere.

On Wed, Sep 30, 2015 at 12:05 PM, David McClosky [email protected]
wrote:

Can you send the full stacktrace for the "jre has value 1.8 but 1.7
required" error?

PyStanfordDependencies on its own doesn't care about the JRE versions, it
just tries to detect when the jars require a different version. Are you
using subprocess or JPype for your backend? (maybe JPype needs JRE 1.7 on
Windows?).


Reply to this email directly or view it on GitHub
#17 (comment)
.

Command: java -ea -cp stanford-parser.jar edu.stanford.nlp.trees.EnglishGrammaticalStructure -basic -treeFile c:\users\crowner\appdata\local\temp\tmp3czf7c -keepPunct
Exit code: 2
stderr: Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

Command: java -ea -cp stanford-parser.jar edu.stanford.nlp.trees.EnglishGrammaticalStructure -basic -treeFile c:\users\crowner\appdata\local\temp\tmpsvzijl -keepPunct
Exit code: 1
stderr: java.lang.UnsupportedClassVersionError: edu/stanford/nlp/trees/EnglishGrammaticalStructure : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Exception in thread "main"

C:\Users\crowner\Desktop\doc\stanford-corenlp-full-2015-04-20>python stanford_de
pendencies_test.py > dependencies_error3.txt
Traceback (most recent call last):
File "stanford_dependencies_test.py", line 10, in
sent = sd.convert_tree('(S1 (NP (DT some) (JJ blue) (NN moose)))',debug=True
)
File "C:\Python27\lib\site-packages\StanfordDependencies\SubprocessBackend.py"
, line 95, in convert_tree
return self.convert_trees([ptb_tree], **kwargs)[0]
File "C:\Python27\lib\site-packages\StanfordDependencies\SubprocessBackend.py"
, line 78, in convert_trees
self._raise_on_bad_exitcode(return_code, stderr, debug)
File "C:\Python27\lib\site-packages\StanfordDependencies\SubprocessBackend.py"
, line 107, in _raise_on_bad_exitcode
raise JavaRuntimeVersionError()
StanfordDependencies.StanfordDependencies.JavaRuntimeVersionError: Your Java run
time is too old (must be 1.8+ to use CoreNLP version 3.5.0 or later and 1.6+ to
use CoreNLP version 1.3.1 or later)

import os

#os.environ['JAVAHOME'] = 'C:\Program Files\Java\jdk1.8.0_60\bin'
#os.environ['JAVAHOME'] = 'C:\Program Files\Java\jdk1.7.0_51\bin'

import StanfordDependencies
sd = StanfordDependencies.get_instance(backend='subprocess', jar_filename='stanford-parser.jar')

sent = sd.convert_tree('(S1 (NP (DT some) (JJ blue) (NN moose)))',debug=True)
for token in sent:
print token

@dmcc
Copy link
Owner

dmcc commented Sep 30, 2015

Hmm, sounds like having two different JREs on Windows is tricky. If it's at all possible, I would only have one version installed (though it sounds like StackOverflow users have found some workarounds).

Yeah, PyStanfordDependencies doesn't look at JAVAHOME unfortunately -- it's basically just running the java command and hoping that will run. In your case, it looks like running java triggers the error about the registry mismatch. So essentially, I think you need to find a way that running java -version prints out 1.8 without any errors. You might also want to try passing the path to a specific java binary with the java_command argument to StanfordDependencies.get_instance -- I'm not a Windows expert (nor do I have access to it) so I'm not sure if this will help.

@ccrowner
Copy link
Author

Some good ideas, thanks.

On Wed, Sep 30, 2015 at 2:26 PM, David McClosky [email protected]
wrote:

Hmm, sounds like having two different JREs on Windows is tricky. If it's
at all possible, I would only have one version installed (though it sounds
like StackOverflow users have found some workarounds).

Yeah, PyStanfordDependencies doesn't look at JAVAHOME unfortunately --
it's basically just running the java command and hoping that will run. In
your case, it looks like running java triggers the error about the
registry mismatch. So essentially, I think you need to find a way that
running java -version prints out 1.8 without any errors. You might also
want to try passing the path to a specific java binary with the
java_command argument to StanfordDependencies.get_instance -- I'm not a
Windows expert (nor do I have access to it) so I'm not sure if this will
help.


Reply to this email directly or view it on GitHub
#17 (comment)
.

@ccrowner
Copy link
Author

One quick question that's probably obvious ;-)

Why are you depending upon the Stanford jar? If you can take a parse tree
and convert it into dependencies it seems that I could call the Stanford
Parser using some other wrapper (e.g. NLTK) and just pass the resulting
tree to your code (again sorry if this is obvious I didn't look so much at
your code logic - just trying to get past nit-noid version problems)

Thanks

On Wed, Sep 30, 2015 at 2:33 PM, Christopher Crowner [email protected]
wrote:

Some good ideas, thanks.

On Wed, Sep 30, 2015 at 2:26 PM, David McClosky [email protected]
wrote:

Hmm, sounds like having two different JREs on Windows is tricky. If it's
at all possible, I would only have one version installed (though it sounds
like StackOverflow users have found some workarounds).

Yeah, PyStanfordDependencies doesn't look at JAVAHOME unfortunately --
it's basically just running the java command and hoping that will run.
In your case, it looks like running java triggers the error about the
registry mismatch. So essentially, I think you need to find a way that
running java -version prints out 1.8 without any errors. You might also
want to try passing the path to a specific java binary with the
java_command argument to StanfordDependencies.get_instance -- I'm not a
Windows expert (nor do I have access to it) so I'm not sure if this will
help.


Reply to this email directly or view it on GitHub
#17 (comment)
.

@dmcc
Copy link
Owner

dmcc commented Sep 30, 2015

It's a good question. PyStanfordDependencies doesn't actually know how to convert trees to dependencies, it just knows two different ways (subprocess and JPype) for calling the conversion code in Stanford CoreNLP/Stanford Parser. In other words, if there was a jar that just had the dependency conversion code in it and didn't include a parser, PyStanfordDependencies would be fine with that. It just uses Stanford CoreNLP/Parser jars by default since those are the ones that are typically distributed.

@ccrowner
Copy link
Author

Thanks, and thanks again for contributing something useful to the community!

On Wed, Sep 30, 2015 at 2:44 PM, David McClosky [email protected]
wrote:

It's a good question. PyStanfordDependencies doesn't actually know how to
convert trees to dependencies, it just knows two different ways (subprocess
and JPype) for calling the conversion code in Stanford CoreNLP/Stanford
Parser. In other words, if there was a jar that just had the dependency
conversion code in it and didn't include a parser, PyStanfordDependencies
would be fine with that. It just uses Stanford CoreNLP/Parser jars by
default since those are the ones that are typically distributed.


Reply to this email directly or view it on GitHub
#17 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants