KNIME: R integration: Execute failed: Exception occured during R initialization.

Cant get R to work with KNIME.

MacOS Catalina - Version 10.15.4
KNIME - Preferences - Path to R home: /Users/xxxxxx/opt/anaconda3/envs/r_env

I have created a link library to lib in the R home, as KNIME was always complaining about not able to find Library in the R home.

ls -ltr /Users/xxxxxx/opt/anaconda3/envs/r_env/library
lrwxr-xr-x 1 xxxxxx staff 3 Apr 25 20:25 /Users/xxxxxxx/opt/anaconda3/envs/r_env/library -> lib

I started rserve process from r_env terminal to test if rserve is configured. Works ok, meaning rserve daemon started and is listening on port localhost:6311

2020-04-25 21:57:25,871 : ERROR : KNIME-Worker-9-R Source (Table) 0:24 : : Node : R Source (Table) : 0:24 : Execute failed: Exception occured during R initialization.

org.knime.r.controller.IRController$RException: Exception occured during R initialization.

at org.knime.r.controller.RController.initR(RController.java:314)

at org.knime.r.controller.RController.initialize(RController.java:195)

at org.knime.r.controller.RController.(RController.java:167)

at org.knime.r.RSnippetNodeModel.executeInternal(RSnippetNodeModel.java:145)

at org.knime.r.RSnippetNodeModel.execute(RSnippetNodeModel.java:136)

at org.knime.core.node.NodeModel.executeModel(NodeModel.java:571)

at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1236)

at org.knime.core.node.Node.execute(Node.java:1016)

at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:557)

at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)

at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:218)

at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:124)

at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:334)

at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:210)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)

at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)

Caused by: java.io.IOException: Could not start Rserve process.

at org.knime.r.rserve.RConnectionFactory.launchRserve(RConnectionFactory.java:293)

at org.knime.r.rserve.RConnectionFactory.createConnection(RConnectionFactory.java:329)

at org.knime.r.controller.RController.initRConnection(RController.java:276)

at org.knime.r.controller.RController.initR(RController.java:310)

… 17 more

Caused by: java.io.IOException: Could not connect to RServe (host: 127.0.0.1, port: 58286).

at org.knime.r.rserve.RConnectionFactory.launchRserve(RConnectionFactory.java:284)

R essestials in r_env (conda)

(r_env) xxxxxx@x86_64-apple-darwin13 bin % conda list |grep -i r-
_r-mutex 1.0.0 anacondar_1
compiler-rt 4.0.1 hcfea43d_1
r-askpass 1.0 r36h1de35cc_0
r-assertthat 0.2.1 r36h6115d3f_0
r-backports 1.1.4 r36h46e59ec_0
r-base 3.6.1 hcb44179_1
r-base64enc 0.1_3 r36h46e59ec_4
r-bh 1.69.0_1 r36h6115d3f_0
r-boot 1.3_20 r36h6115d3f_0
r-broom 0.5.2 r36h6115d3f_0
r-cairo 1.5_10 r36h46e59ec_0
r-callr 3.2.0 r36h6115d3f_0
r-caret 6.0_83 r36h46e59ec_0
r-cellranger 1.1.0 r36h6115d3f_0
r-class 7.3_15 r36h46e59ec_0
r-cli 1.1.0 r36h6115d3f_0
r-clipr 0.6.0 r36h6115d3f_0
r-cluster 2.0.8 r36hfffe0aa_0
r-codetools 0.2_16 r36h6115d3f_0
r-colorspace 1.4_1 r36h46e59ec_0
r-crayon 1.3.4 r36h6115d3f_0
r-curl 3.3 r36h46e59ec_0
r-data.table 1.12.2 r36h46e59ec_0
r-dbi 1.0.0 r36h6115d3f_0
r-dbplyr 1.4.0 r36h6115d3f_0
r-dichromat 2.0_0 r36h6115d3f_4
r-digest 0.6.18 r36h46e59ec_0
r-dplyr 0.8.0.1 r36h466af19_0
r-ellipsis 0.1.0 r36h46e59ec_0
r-essentials 3.6.0 r36_0
r-evaluate 0.13 r36h6115d3f_0
r-fansi 0.4.0 r36h46e59ec_0
r-forcats 0.4.0 r36h6115d3f_0
r-foreach 1.4.4 r36h6115d3f_0
r-foreign 0.8_71 r36h46e59ec_0
r-formatr 1.6 r36h6115d3f_0
r-fs 1.2.7 r36h466af19_0
r-generics 0.0.2 r36h6115d3f_0
r-ggplot2 3.1.1 r36h6115d3f_0
r-glmnet 2.0_16 r36hfffe0aa_0
r-glue 1.3.1 r36h46e59ec_0
r-gower 0.2.0 r36h46e59ec_0
r-gtable 0.3.0 r36h6115d3f_0
r-haven 2.1.0 r36h466af19_0
r-hexbin 1.27.2 r36hfffe0aa_0
r-highr 0.8 r36h6115d3f_0
r-hms 0.4.2 r36h6115d3f_0
r-htmltools 0.3.6 r36h466af19_0
r-htmlwidgets 1.3 r36h6115d3f_0
r-httpuv 1.5.1 r36h466af19_0
r-httr 1.4.0 r36h6115d3f_0
r-ipred 0.9_8 r36h46e59ec_0
r-irdisplay 0.7.0 r36h6115d3f_0
r-irkernel 0.8.15 r36_0
r-iterators 1.0.10 r36h6115d3f_0
r-jsonlite 1.6 r36h46e59ec_0
r-kernsmooth 2.23_15 r36hfffe0aa_4
r-knitr 1.22 r36h6115d3f_0
r-labeling 0.3 r36h6115d3f_4
r-later 0.8.0 r36h466af19_0
r-lattice 0.20_38 r36h46e59ec_0
r-lava 1.6.5 r36h6115d3f_0
r-lazyeval 0.2.2 r36h46e59ec_0
r-lubridate 1.7.4 r36h466af19_0
r-magrittr 1.5 r36h6115d3f_4
r-maps 3.3.0 r36h46e59ec_0
r-markdown 0.9 r36h46e59ec_0
r-mass 7.3_51.3 r36h46e59ec_0
r-matrix 1.2_17 r36h46e59ec_0
r-mgcv 1.8_28 r36h46e59ec_0
r-mime 0.6 r36h46e59ec_0
r-modelmetrics 1.2.2 r36h466af19_0
r-modelr 0.1.4 r36h6115d3f_0
r-munsell 0.5.0 r36h6115d3f_0
r-nlme 3.1_139 r36hfffe0aa_0
r-nnet 7.3_12 r36h46e59ec_0
r-numderiv 2016.8_1 r36h6115d3f_0
r-openssl 1.3 r36h46e59ec_0
r-pbdzmq 0.3_3 r36h466af19_0
r-pillar 1.3.1 r36h6115d3f_0
r-pkgconfig 2.0.2 r36h6115d3f_0
r-plogr 0.2.0 r36h6115d3f_0
r-plyr 1.8.4 r36h466af19_0
r-prettyunits 1.0.2 r36h6115d3f_0
r-processx 3.3.0 r36h46e59ec_0
r-prodlim 2018.04.18 r36h466af19_0
r-progress 1.2.0 r36h6115d3f_0
r-promises 1.0.1 r36h466af19_0
r-ps 1.3.0 r36h46e59ec_0
r-purrr 0.3.2 r36h46e59ec_0
r-quantmod 0.4_14 r36h6115d3f_0
r-r6 2.4.0 r36h6115d3f_0
r-randomforest 4.6_14 r36hfffe0aa_0
r-rbokeh 0.6.3 r36_0
r-rcolorbrewer 1.1_2 r36h6115d3f_0
r-rcpp 1.0.1 r36h466af19_0
r-rcpproll 0.3.0 r36h466af19_0
r-readr 1.3.1 r36h466af19_0
r-readxl 1.3.1 r36h466af19_0
r-recipes 0.1.5 r36h6115d3f_0
r-recommended 3.6.0 r36_0
r-rematch 1.0.1 r36h6115d3f_0
r-repr 0.19.2 r36h6115d3f_0
r-reprex 0.2.1 r36h6115d3f_0
r-reshape2 1.4.3 r36h466af19_0
r-rjava 0.9_12 r36h17f1fa6_0 conda-forge
r-rlang 0.3.4 r36h46e59ec_0
r-rmarkdown 1.12 r36h6115d3f_0
r-rpart 4.1_15 r36h46e59ec_0
r-rserve 1.7_3.1 r36h466af19_0
r-rstudioapi 0.10 r36h6115d3f_0
r-rvest 0.3.3 r36h6115d3f_0
r-scales 1.0.0 r36h466af19_0
r-selectr 0.4_1 r36h6115d3f_0
r-shiny 1.3.2 r36h6115d3f_0
r-sourcetools 0.1.7 r36h466af19_0
r-spatial 7.3_11 r36h46e59ec_4
r-squarem 2017.10_1 r36h6115d3f_0
r-stringi 1.4.3 r36h466af19_0
r-stringr 1.4.0 r36h6115d3f_0
r-survival 2.44_1.1 r36h46e59ec_0
r-sys 3.2 r36h46e59ec_0
r-tibble 2.1.1 r36h46e59ec_0
r-tidyr 0.8.3 r36h466af19_0
r-tidyselect 0.2.5 r36h466af19_0
r-tidyverse 1.2.1 r36h6115d3f_0
r-timedate 3043.102 r36h6115d3f_0
r-tinytex 0.12 r36h6115d3f_0
r-ttr 0.23_4 r36hfffe0aa_0
r-utf8 1.1.4 r36h46e59ec_0
r-uuid 0.1_2 r36h46e59ec_4
r-viridislite 0.3.0 r36h6115d3f_0
r-whisker 0.3_2 r36h6115d3f_4
r-withr 2.1.2 r36h6115d3f_0
r-xfun 0.6 r36h6115d3f_0
r-xml2 1.2.0 r36h466af19_0
r-xtable 1.8_4 r36h6115d3f_0
r-xts 0.11_2 r36h46e59ec_0
r-yaml 2.2.0 r36h46e59ec_0
r-zoo 1.8_6 r36h46e59ec_0
(r_env) xxxxxxxx@x86_64-apple-darwin13 bin %

Rserve is available in the library -
/Users/xxxxxxx/opt/anaconda3/envs/r_env/lib/R/bin/Rserve

(r_env) xxxxxxx@x86_64-apple-darwin13 bin % ps -eaf|grep -i rserve
501 3005 1 0 9:53PM ?? 0:00.14 /Users/xxxxxxx/opt/anaconda3/envs/r_env/lib/R/bin/Rserve
501 4366 70367 0 10:20PM ttys001 0:00.00 grep -i rserve
(r_env) xxxxxxx@x86_64-apple-darwin13 bin %

@dyagaty welcome to the KNIME forum

Getting KNIME and R work together can be challenging. There is this thread that should help with your problem

Installing Rserve 1.8-6 on macOS 10.15. (Catalina)

And maybe @Mark_Ortmann can give us an update about the upcoming publication of the mentioned script.

3 Likes

Thank you, will try it out !

@mlauber71,

once more thx for bringing this to my attention.
The documentation is in its final throes and will hopefully published early next week.

@dyagaty,
I asumme you have RServe 1.7.3 installed right now. You can check this by starting R from your terminal and then typing

> library(“Rserve”)
> sessionInfo()

If this is the case please run

> remove.packages(“Rserve”)
> install.packages(“Rserve”,“http://rforge.net”)

If you see the following errror

cannot find -lssl

You could try running this script
https://bitbucket.org/KNIME/knime-r/src/master/org.knime.r/scripts/mac_10.14_or_higher.sh

However, this will not work if on your console you cannot type

R

to open R. In this case you have to adapt the R calls according to your R location or expose the path containing the R executable

If you need help let me know.

Mark

P.S. Don’t try to install RServe via Anaconda as this installs 1.7.3

3 Likes

Thanks @Mark_Ortmann and @mlauber71 for your assistance !
I ditched conda env and installed using Mark’s script, and IT’S ALIVE !!

Few errors during install -

configure: error: Cannot use cairo-ft backend, although cairo claims it is working. Please check your caito installation and/or update cairo if necessary or set CAIRO_CFLAGS/CAIRO_LIBS accordingly.
ERROR: configuration failed for package ‘Cairo’

  • removing ‘/Users/yagaty/Library/R/3.6/library/Cairo’

Error: openssl@1.1 1.1.1f is already installed
To upgrade to 1.1.1g, run brew upgrade openssl@1.1
Error: Failure while executing; find /usr/local/Cellar/openssl@1.1/1.1.1f -not -type d -print exited with 127. Here’s the output:

1 Like

Regarding Cairo you have to install XQuartz and install the package it again I guess.

The other problem I’ll have a look at tomorrow.

1 Like

Here is link to the R Installation Guide with script location:
https://docs.knime.com/latest/r_installation_guide/index.html

1 Like