I would like to know how to install and run R packages/libraries in KNME Server.
I use the R Snippet node and I install the following package in my R script:
install.packages(“mlr”)
library(mlr)
If I execute by right click on the node, my script runs fine. However, when I execute from Server (image), I get the following error. I see that the path is the problem, but I do not know what and where can I choose the right on:
There are messages for workflow “model_testR 2019-03-25 14.33.39”
R Snippet 0:82 - ERROR: Execute failed: Error in R code:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(“mlr”) :
‘lib = “/usr/local/lib/R/site-library”’ is not writable
Error: unable to install packages
Error: there is no package called ‘mlr’
Based on the error message, it appears that the user who runs the KNIME Server process does not have write permissions in ‘/usr/local/lib/R/site-library’.
Can you please give permissions to that directory? That should fix the issue.
Thank you very much for your support! I’ve tried around, but still it doesn’t work for me.
I found another discussion (link) and maybe I have to change the R path in the “preferences.epf” file and save it in the Server repository.
However, I don’t know how to access the server repository because our server is running in AWS.
We are able to load R ‘within KNIME’ but we are not allowed to install any new packages. That’s why we tried to point KNIME to a separate R version on our system (as described here).
We also tried to install the packages on a new defined folder install.packages(“ggplot2”, lib="/tmp/Rpackages/")),
it worked, but when we load them via library(ggplot2, lib.loc="/tmp/Rpackages/")
we get the following error:
In that case, you actually have to change the path to the R installation in the preferences.epf. Since your KNIME Server is hosted on AWS, you have to access that file via SSH.
The error in your screenshot suggests that you already have an R installation configured in preferences.epf, but this might not be the one you are trying to use.