rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.68k stars 327 forks source link

spacy module -- #87

Closed Nayyarkazmi closed 7 years ago

Nayyarkazmi commented 7 years ago

I have been trying to setup spacy in R. I have installed using conda 3.6.1. I can import the module in python. But when I use py_config(), it doesn't show spacy version in RStudio. py_module_available("spacy") also return FALSE. Hence, I cant use init_spaCy(). Any help/suggestion will be greatly appreciated.

> reticulate::py_config()

python: C:\Users\nayyark\AppData\Local\CONTIN~1\ANACON~1\python.exe libpython: C:/Users/nayyark/AppData/Local/CONTIN~1/ANACON~1/python36.dll pythonhome: C:\Users\nayyark\AppData\Local\CONTIN~1\ANACON~1 version: 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)] Architecture: 64bit numpy: C:\Users\nayyark\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\numpy numpy_version: 1.12.1 spacy: C:\Users\nayyark\AppData\Local\CONTIN~1\ANACON~1\lib\site-packages\spacy

python versions found: C:\Users\nayyark\AppData\Local\CONTIN~1\ANACON~1\python.exe C:\Users\nayyark\AppData\Local\CONTIN~1\ANACON~1/envs/tensorflow/python.exe

> py_module_available("numpy")

[1] TRUE

py_module_available("spacy") [1] FALSE py_module_available("spaCy") [1] FALSE

Nayyarkazmi commented 7 years ago

Also when I run import("spacy"), i get the following error

> import("spacy")

Error in py_module_import(module, convert = convert) : TypeError: 'int' object is not callable

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

jjallaire commented 7 years ago

We're unable to reproduce problems loading spacy in our local environment (Windows 10, Anaconda, etc.). There could be many things wrong with your configuration all of which are very difficult to diagnose remotely.

You should know though that this does work in general and using spacy with reticulate is done elsewhere e.g. in the spacyr package (https://github.com/kbenoit/spacyr)