KNIME Server & R Snippet/Packages install

Hi all!

Please, I need some support.

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’

KNIME_ExecuteFromServer

Thank you in advance!!!

Hi @Kassiani_Tsouvala,

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.

Cheers,
Roland

2 Likes

Hi @Kassiani_Tsouvala

You could also try installing to a local directory where the server has write access, maybe something like the following can work:

install.packages("ggplot2", lib="/tmp/Rpackages/")
library(ggplot2, lib.loc="/tmp/Rpackages/")

best,
Gabriel

1 Like

Hello @gab1one, @RolandBurger,

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.

Any idea is more than welcome :slight_smile:
Thank you!

Hi @Kassiani_Tsouvala,

The R path in your preferences.epf is not the issue here - if it was, you wouldn’t even be able to load R, i.e., there would be a different error.

Hi @RolandBurger,
thanks for your fast reply! I work together with @Kassiani_Tsouvala on the issue.

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:

image

Thank you in advance :slight_smile:

1 Like

Hi @katrin,

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.

Cheers,
Roland

1 Like