brendano / stanford_corenlp_pywrapper

151 stars 59 forks source link

Error ..INFO:StanfordSocketWrap:Waiting for startup: ping got exception: <class 'socket.error'> [Errno 111] Connection refused #10

Closed achalghoum closed 9 years ago

achalghoum commented 9 years ago

Hello I've been trying to use Pywrapper with Corenlp 3.4.1 and I've been getting this error

INFO:StanfordSocketWrap:Starting pipe subprocess, and waiting for signal it's ready, with    command:  java -Xmx2000M -cp /usr/local/lib/python2.7/dist-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/piperunner.jar:/usr/local/lib/python2.7/dist-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/guava-13.0.1.jar:/usr/local/lib/python2.7/dist-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/jackson-all-1.9.11.jar:/home/amine/workspace/Harp/src/nlp/stanford-corenlp-full-2014-08-27/stanford-corenlp-3.4.1.jar:/home/amine/workspace/Harp/src/nlp/stanford-corenlp-full-2014-08-27/stanford-corenlp-3.4.1-models.jar:/home/amine/workspace/Harp/src/nlp/stanford-corenlp-full-2014-08-27/stanford-srparser-2014-10-23-models.jar     corenlp.PipeCommandRunner --server 12345  --mode justparse --configfile /home/amine/workspace/Harp/src/nlp/sample.ini
[Server] Using mode type: justparse
Adding annotator tokenize
TokenizerAnnotator: No tokenizer type provided. Defaulting to PTBTokenizer.
Adding annotator ssplit
edu.stanford.nlp.pipeline.AnnotatorImplementations:
Adding annotator pos
Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1,6 sec].
Adding annotator parse
Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ...INFO:StanfordSocketWrap:Waiting for startup: ping got exception: <class 'socket.error'> [Errno 111] Connection refused
done [0,8 sec].
[Server] Using CoreNLP configuration file: /home/amine/workspace/Harp/src/nlp/sample.ini
Adding annotator tokenize
Adding annotator ssplit
Adding annotator pos
Adding annotator lemma
Adding annotator parse
Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ...INFO:StanfordSocketWrap:Waiting for startup: ping got exception: <class 'socket.error'> [Errno 111] Connection refused
INFO:StanfordSocketWrap:Waiting for startup: ping got exception: <class 'socket.error'> [Errno 111] Connection refused
INFO:StanfordSocketWrap:Waiting for startup: ping got exception: <class 'socket.error'> [Errno 111] Connection refused

Here's the code: parser=sockwrap.SockWrap("justparse",server_port=12345, corenlp_libdir=dir+"/stanford-corenlp-full-2014-08-27", corenlp_jars=("stanford-corenlp-3.4.1.jar", "stanford-corenlp-3.4.1-models.jar", "stanford-srparser-2014-10-23-models.jar"), configfile=dir+'/sample.ini') and while this command: java -Xmx2000M -cp /usr/local/lib/python2.7/dist-packages/stanford_corenlp_pywrapper-0.1.0- py2.7.egg/stanford_corenlp_pywrapper/lib/piperunner.jar:/usr/local/lib/python2.7/dist-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/guava-13.0.1.jar:/usr/local/lib/python2.7/dist-packages/stanford_corenlp_pywrapper-0.1.0-py2.7.egg/stanford_corenlp_pywrapper/lib/jackson-all-1.9.11.jar:/home/amine/workspace/Harp/src/nlp/stanford-corenlp-full-2014-08-27/stanford-corenlp-3.4.1.jar:/home/amine/workspace/Harp/src/nlp/stanford-corenlp-full-2014-08-27/stanford-corenlp-3.4.1-models.jar:/home/amine/workspace/Harp/src/nlp/stanford-corenlp-full-2014-08-27/stanford-srparser-2014-10-23-models.jar corenlp.PipeCommandRunner --server 12345 --mode justparse --configfile /home/amine/workspace/Harp/src/nlp/sample.ini works fine,the code fails. I'd be thankful if you could help me . Amine

brendano commented 9 years ago

If you start the server manually, can you connect to it from another process? After the server says it's started, open up a new terminal and do "telnet localhost 12345".

achalghoum commented 9 years ago

I upped STARTUP_BUSY_WAIT_INTERVAL_SEC to 200 and now it's loading fine ,log : [Server] Using mode type: justparse Adding annotator tokenize TokenizerAnnotator: No tokenizer type provided. Defaulting to PTBTokenizer. Adding annotator ssplit edu.stanford.nlp.pipeline.AnnotatorImplementations: Adding annotator pos Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1,5 sec]. Adding annotator parse Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ...done [1,4 sec]. [Server] Using CoreNLP configuration file: /home/amine/workspace/Harp/src/nlp/sample.ini Adding annotator tokenize Adding annotator ssplit Adding annotator pos Adding annotator lemma Adding annotator parse Loading parser from serialized file edu/stanford/nlp/models/srparser/englishSR.ser.gz ...done [22,8 sec]. [Server] Started socket server on port 12345 but it freezes afterwards , thank you for your amazingly quick reply :+1

brendano commented 9 years ago

ok, sounds like increasing STARTUP_BUSY_WAIT_INTERVAL_SEC was the issue here.