smilli / py-corenlp

Python wrapper for Stanford CoreNLP
353 stars 75 forks source link

Import error message #21

Closed mensurdurakovic closed 7 years ago

mensurdurakovic commented 7 years ago

Installed pycorenlp through pip:

pip install pycorenlp

Run the server, but still when I run this code:

from pycorenlp import StanfordCoreNLP

nlp = StanfordCoreNLP('http://localhost:9000')
res = nlp.annotate("I love you. I hate him. You are nice. He is dumb",
                   properties={
                       'annotators': 'sentiment',
                       'outputFormat': 'json',
                       'timeout': 1000,
                   })
for s in res["sentences"]:
    print("%d: '%s': %s %s" % (
        s["index"],
        " ".join([t["word"] for t in s["tokens"]]),
        s["sentimentValue"], s["sentiment"]))

I get error message:

Traceback (most recent call last):
  File "C:/path_to_file/test_corenlp.py", line 1, in <module>
    from pycorenlp import StanfordCoreNLP
ModuleNotFoundError: No module named 'pycorenlp'

tried to look at closed issue with same error, but no help. Anyone experiencing this error ?

mensurdurakovic commented 7 years ago

Had Anaconda installed but all pip lib instalations were in C:\Python36 dir, moved it to Anaconda folder and now all is ok