philipperemy / stanford-openie-python

Stanford Open Information Extraction made simple!
ISC License
635 stars 102 forks source link

Crash when running example code #52

Closed zhaone closed 2 years ago

zhaone commented 2 years ago

Hi. Thanks for your work. I try to run your example but got the following exception

Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from openie import StanfordOpenIE
>>> client = StanfordOpenIE()
>>> client.annotate('Barack Obama was born in Hawaii. Richard Manning wrote this sentence.')
Starting server with command: java -Xmx8G -cp /data/user/zhaoyi/.stanfordnlp_resources/stanford-corenlp-4.1.0/* edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 60000 -threads 5 -maxCharLength 100000 -quiet True -serverProperties corenlp_server-de9d1769965b435c.props -preload openie
Traceback (most recent call last):
  File "/data/user/zhaoyi/anaconda3/lib/python3.8/site-packages/stanfordnlp/server/client.py", line 330, in _request
    r.raise_for_status()
  File "/data/user/zhaoyi/anaconda3/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://localhost:9000/?properties=%7B%27annotators%27%3A+%27openie%27%2C+%27outputFormat%27%3A+%27json%27%7D

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/user/zhaoyi/stanford-openie-python/openie/openie.py", line 55, in annotate
    core_nlp_output = self.client.annotate(text=text, annotators=['openie'], output_format='json',
  File "/data/user/zhaoyi/anaconda3/lib/python3.8/site-packages/stanfordnlp/server/client.py", line 398, in annotate
    r = self._request(text.encode('utf-8'), request_properties, **kwargs)
  File "/data/user/zhaoyi/anaconda3/lib/python3.8/site-packages/stanfordnlp/server/client.py", line 336, in _request
    raise AnnotationException(r.text)
stanfordnlp.server.client.AnnotationException: java.lang.IllegalArgumentException: annotator "openie" requires annotation "CorefChainAnnotation". The usual requirements for this annotator are: tokenize,ssplit,pos,lemma,depparse,natlog
philipperemy commented 2 years ago

Can you update your Java version a bit? It seems that you are running an old version from 2014. I'm not sure if it's the issue though. But it seems like all your stack is from 2009. So it's possible that some components failed to launch properly and you get this error as a result. Try with a recent version of CentOS.

zhaone commented 2 years ago

Thanks. I upgraded my java from 1.8 to java 11 (the same version as my mac java), and I also tried installing openie from this repository but still met the same Error.

philipperemy commented 2 years ago

Hmmm. Probably your OS is too old? Can you try without anaconda? Just plain python.

philipperemy commented 2 years ago

I'll close this issue for inactivity.