Closed ghost closed 5 years ago
Did you download and set up the CoreNLP package by following this setup guide?
I have the same problem each time after annotated 2000+ sentences, you can find if there is some thing overflow upd: It's true, after I limit run times of each annotator instance's, it can work well.
if client is None or annotate_time > 1000:
client = None
time.sleep(5)
client = CoreNLPClient(annotators=['ssplit', 'tokenize'], memory='8G', timeout=30000)
annotate_time=0
Did you download and set up the CoreNLP package by following this setup guide?
Yes. I followed the setup guide and specified the path in my code.
I just tried the running the same code on a Ubuntu system with 10000 test sentences and everything works fine for me. It is hard to find what's going on without further information.
@sudeshna-d Can you try initializing the CoreNLPClient
with be_quiet=False
argument and rerun your example? This will allow the underlying CoreNLP logs to be printed to stderr. We may be able to find out what's going with the CoreNLP logs. Something like this should work:
# set up the client
with CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner','parse','depparse','coref'], timeout=30000, memory='16G', be_quiet=False) as client:
# other code
@fpcsong It is also likely that a specific sentence crashed the CoreNLP server, which then generated this PermanentlyFailedException
for you. Can you try:
be_quiet=False
argument as detailed above and rerun your code;@yuhaozhang
This is the error that I get on using the be_quiet=False
argument:
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-5-7569e3faaa93> in <module>
18
19 # set up the client
---> 20 with CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner','parse','depparse','coref'], timeout=30000, memory='16G',be_quiet=False) as client:
21 # submit the request to the server
22 ann = client.annotate(text)
~/envs/.env/lib/python3.6/site-packages/stanfordnlp/server/client.py in __enter__(self)
87
88 def __enter__(self):
---> 89 self.start()
90 return self
91
~/envs/.env/lib/python3.6/site-packages/stanfordnlp/server/client.py in start(self)
77 self.server = subprocess.Popen(self.start_cmd,
78 stderr=stderr,
---> 79 stdout=stderr)
80
81 def stop(self):
/usr/lib/python3.6/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
685 (p2cread, p2cwrite,
686 c2pread, c2pwrite,
--> 687 errread, errwrite) = self._get_handles(stdin, stdout, stderr)
688
689 # We wrap OS handles *before* launching the child, otherwise a
/usr/lib/python3.6/subprocess.py in _get_handles(self, stdin, stdout, stderr)
1202 else:
1203 # Assuming file-like object
-> 1204 c2pwrite = stdout.fileno()
1205
1206 if stderr is None:
UnsupportedOperation: fileno
@sudeshna-d That's weird. It seems like the issue is not even in stanfordnlp
, but a call to the native python subprocess
library. Seems like a fileno()
function call is not supported for your stdout
object.
Are you running python directly from your terminal or an IDE. If the latter, seems like someone has reported a similar issue here: https://stackoverflow.com/questions/31080829/python-error-io-unsupportedoperation-fileno.
@yuhaozhang I am using Jupyter Notebook. The demo code does work when used directly from terminal. Thanks for all the help!
@sudeshna-d If you want to run in Jupyter Notebook execute without the with block.
Hi, I suffer the same problem . Have you already solved this problem?
I am trying out the demo code for using the CoreNLP server.
gives me this error:
PermanentlyFailedException: Timed out waiting for service to come alive.
I tried increasing the timeout limit, but no success.