Text uses an r-package called reticulate as an interface to Python, and the Python packages torch and transformers. Reticulate normally installs these necessary packages automatically, however, if you receive errors indicating either of these packages are missing follow the instructions below.
library(text) # To install the python packages torch, transformers, numpy and nltk through R, run: library(reticulate) install_miniconda() conda_install(envname = 'r-reticulate', c('torch==0.4.1', 'transformers==3.3.1', 'numpy', 'nltk'), pip = TRUE) # Windows 10 conda_install(envname = 'r-reticulate', c('torch==0.4.1', 'transformers==3.3.1', 'numpy', 'nltk'))
##Checking your versions If something isn’t working right, it is a good start to examine what is installed and running on your system. For example to make sure that you have R and Python versions that are up to date.
# First check R-version and which packages that are attached and loaded. sessionInfo() # Second check out python version; and make sure you at least have version 3.6.10 library(reticulate) py_config()
After a new install/update of text, RStudio crashed (Abort session) when running functions that fetches word embeddings (i.e.,
To solve the issue re-install reticulate (development version) and uninstall and install r-miniconda.
Uninstall r-miniconda by removing its entire folder (which by default [in Mac] is at
(Note that [in Mac] the Library folder is hidden, so to make it visible go to Finder and the path Users/YOUR_USER_NAME/ and press the three keys:
COMMAND + SHIFT + . . Then the Library-folder should appear, and you can find and remove r-miniconda.
library(text) # To re-install packages start with a fresh session by restarting R and RStudio # Install development of reticulate (might not be necessary) devtools::install_github("rstudio/reticulate") # After having manually removed the r-miniconda folder, install it again: library(reticulate) install_miniconda() # Subsequently re-install torch, transformers, numpy and nltk by running: conda_install(envname = 'r-reticulate', c('torch==0.4.1', 'transformers==3.3.1', 'numpy', 'nltk'), pip = TRUE)