quanteda / spacyr

R wrapper to spaCy NLP
http://spacyr.quanteda.io
250 stars 38 forks source link

Error after spacy_initilize #68

Closed nujcharee closed 6 years ago

nujcharee commented 7 years ago

I got an error after running spacy_initialize() as per below. Please kindly advice. Thank you.

Python space is already attached. If you want to swtich to a different Python, please restart R. Error in py_run_file_impl(file, local, convert) : TypeError: 'int' object is not callable

Detailed traceback: File "", line 9, in File "C:\Users\nhaswell\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\spacy__init.py", line 8, in from . import en, de, zh, es, it, hu, fr, pt, nl, sv, fi, bn, he File "C:\Users\nhaswell\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\spacy\en\init.py", line 4, in from ..language import Language File "C:\Users\nhaswell\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\spacy\language.py", line 11, in from .train import Trainer File "C:\Users\nhaswell\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\spacy\train.py", line 5, in import tqdm File "C:\Users\nhaswell\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\tqdm\init__.py", line 1, in from ._tqdm import tqdm File "C:\Users\nhaswell\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\tqdm_tqdm.py", line 14, in from ._utils

amatsuo commented 7 years ago

It seems that the issue is purely a python problem.

Could you load spacy in python? What happens if you enter following in a python console?

import spacy
nlp = spacy.load("en")
nujcharee commented 7 years ago

Hi there yeb all good, I went on to test a different thing as per spacy.io website.... got the result as expected.

nlp = spacy.load("en") doc1 = nlp(u'the fries were gross') doc2 = nlp(u'the worst fries ever') doc1.similarity(doc2) 0.82711923100769391

So I tried again today in Rstudio today

library(reticulate) use_python("C:/Users/nhaswell/AppData/Local/Continuum/Anaconda3/python") spacy_initialize(python_executable = "C:/Users/nhaswell/AppData/Local/Continuum/Anaconda3/python") Error in reticulate::use_python(python_executable, required = TRUE) : Specified version of python 'C:/Users/nhaswell/AppData/Local/Continuum/Anaconda3/python' does not exist.