I'm using Windows 8, and running python in eclipse with pyDev.
I installed Stanford coreNLP (python version) from the site: https://github.com/relwell/stanford-corenlp-python
When I try to import corenlp, I get the following error message.
Traceback (most recent call last):
File "C:\Users\Ghantauke\workspace\PythonTest2\test.py", line 1, in <module>
import corenlp
File "C:\Python27\lib\site-packages\corenlp\__init__.py", line 13, in <module>
from corenlp import StanfordCoreNLP, ParserError, TimeoutError, ProcessError
File "C:\Python27\lib\site-packages\corenlp\corenlp.py", line 28, in <module>
import pexpect
File "C:\Python27\lib\site-packages\pexpect.py", line 85, in <module>
support it. Pexpect is intended for UNIX-like operating systems.""")
ImportError: No module named resource
A critical module was not found. Probably this operating system does not
support it. Pexpect is intended for UNIX-like operating systems.
Does that mean the python fork of it doesn't work in windows? Is there any way I can make it work in windows?
If not then could you suggest other alternatives that I could use in windows. I just need the parser.
This is a record of my attempts to get
corenlp-python
, the python wrapper for CoreNLP running on Windows Server 2012, as-is.Starting out
Since
corenlp-python
usespexpect
fairly heavily, and that library works on UNIX only, my first thought was to find a Windows port.wexpect.py was fairly easy to find and claims to be a drop-in replacement for Pexpect (emphasis mine):
So I did just that, downloading and installing CygWin, then copying
wexpect.py
intoC:\Python27\lib\
where all the other libraries were. I tried toimport wexpect
from a Python shell and got an error similar to when I first tried Pexpect on Windows:Et tu, wexpect?
No matter, this is standard frustration for finding equivalents. Press on.
I opened
wexpect.py
and saw that it would only trypywintypes
on a Windows system. Logical, so I tried:...which failed, and led me to Google for the name of the python Win32 packages (this answer helped):
...which prompts for
--allow-external
and then--allow-unverified
, both of which expect the package name, ergo:Which, of course, does not work. No such package is found.
sf.net
So I head off to search for pywin32 on PyPI and realise that only a readme is left and I have to jump through four MORE hoops to get to something more substantial, then two more to find this list.
I downloaded Build 219 for Python 2.7 32-bit. At least now
import wexpect
doesn't puke.What did you expect?
So I run the
corenlp-python
command again, and this time it's missingunidecode
. This was easier to fix, and finally I got to a usable state - an error, no less, but familiar - where the path to the JARs was not correct.OK.
When you run
corenlp.py
, sincepexpect
is invoked, remember toimport wexpect as pexpect
near the top and comment out the realimport pexpect
line, or you will get aNameError
:Even with Java installed, this does not seem to work, regardless of path.
It returns an
ExceptionPexpect
.