statsmaths / cleanNLP

R package providing annotators and a normalized data model for natural language processing
GNU Lesser General Public License v2.1
209 stars 36 forks source link

use_python not changing environment #38

Closed fahadshery closed 5 years ago

fahadshery commented 5 years ago

Hi,

Already looked here and can confirm that I have installed anaconda3 as required. When run the reticulate::use_python("/Users/my_user/anaconda3/bin/python") and then restarting R is still looking at the old python2.7 that comes preinstalled with macOS. Here is the config: `> reticulate::py_config() python: /usr/bin/python libpython: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib pythonhome: /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7 version: 2.7.10 (default, Aug 17 2018, 17:41:52) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] numpy: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy numpy_version: 1.8.0

python versions found: /usr/bin/python /Users/my_user/anaconda3/bin/python`

I have installed spacy but its not being picked up because of this reason

fahadshery commented 5 years ago

Apologies just solved it by:

1-reloading RStudio 2-library("reticulate") use_python("/Users/my_user/anaconda3/bin/python", required = T) Before anything else. Check with py_config()

It can load init_spacy now

statsmaths commented 5 years ago

Excellent. Yes, you need to re-start R for the reticulate functions to pick a different version of Python (this is poorly documented and easily avoided).