Install R alongside KNIME on Windows and MacOS

#1

Over the last months I have collected a few entries about the installation of R alongside KNIME that contain some maybe useful hints how to overcome certain obstacles while installing them. I want to bring them together here. (If you are looking for a basic guide about how to install R in the first place you might look here or here).

A few maybe unnecessary remarks upfront. Yes it takes some effort to get KNIME and R up and running but in the end you will be rewarded with the whole world of possibilities R has to offer, and you will be able to solve some tasks that you were not able to easily solve before while having the power of the workflow concept of one of the leading Data Scientist platforms at you fingertips.

OK first there are two ‘flavours’ of R you can install, on Windows the integrated Binaries (KNIME would manage all of R) or you get yourself a standalone version of R (which I strongly recommend, and I recommend using the 64 Bit version wherever possible). Alongside that I recommend installing RStudio to easily manage R and that can also be useful in itself. To work with KNIME R needs several packages most prominently RServe (we come to that in a minute) and Cairo. But you will be able and have to install further libraries as your tasks evolve.

Once you have R up and running you will need RServe so that KNIME nodes can communicate with it. Again there are two flavours of nodes one is the R environment managed by KNIME itself and then there is R Scripting from the community. The difference in using that is that the KNIME-managed one would just call RServe by itself while the R community nodes need RServe to be manually started from within R and the RServe needs to be up and running while using the nodes - that can be confusing, so maybe you stick with KNIME’s own nodes for now.

About the RServe library itself …

There have been some problems with that and it is highly recommended you use the latest version of it which ist 1.8.6 as of now (Jan 2019).

In theory this should be as easy as running this line in your R or RStudio.

install.packages('Rserve',,"http://rforge.net/",type="source")

or if you have the file in a local folder something like:

install.packages('~/Downloads/Rserve_1.8-6.tar', repos = NULL, type="source")

If that is not working you can try to install it manually by downloading the package - or trying to compile it yourself as we have discussed here:

I also have an entry about being able to compile packages on Mac:

Compiling the Rserve package on MacOS seems to be particularly tricky and seems to depend very much on the exact version of MacOS you use. Several steps have helped in the past.

And please be aware that these hints might not work on every system or under any circumstances and as I have experienced these settings tend to change a lot, so please be patient and keep working on setting this up.

Being able to compile R libraries can also come in handy if you want to stay on top of the latest developments or you have some academic packages that are not hosted in a binary form on some server. Of course using new libraries can also bring some challenges with stability and bugs - like it is with advanced (free) software.

Yes there is some work to do but you will be better off once you have invested the effort. Hope you enjoy KNIME and R and if you have questions there is always the KNIME forum and the good people from KNIME there to help.


Since we are at it I want to share some more quirks about R that I have come across over the months. They may or may not be relevant for your problems.

  1. On windows RTools for compiling packages seem not to like very long and complex paths. So stick to something like c:\rtools instead of something fancy.

  2. When installing new packages I have encountered problems with timezone. I could solve them by explicitly giving a timezone cf. this entry.

  3. Especially on Windows RServe seems to be picky if other instances of it are running parallel. So if you for example have a windows server and several people do use the same installation of R you might run into problems (I think there is a mention of that somewhere on the Rserve page). You might try for everyone to use their separate installations or different ports. Also you would want not to start too many instances of R at the same time.

  4. For further problems with compilation of Rserve please see this entry about command line compilation with Rtools on Windows

13 Likes

How do I get the KNIME R-Project nodes
R nodes hang
R nodes not working after Uodate to 3.1
Venn / Euler diagrams
Venn / Euler diagrams
Working Days/Network Days between two dates
Working Days/Network Days between two dates
R cannot be initialized
Errno8
R-Server vs. RStudio
Errno8
Configuring R scripting with conda
Path to R Home failed
Integrating R with Knime
Problems implementing R in Knime
R scripting not loading on KNIME startup
Path to R Home does not contain an R Executable
R Node Problems on macOS for R version 3.5.3 with KNIME 3.7.1
Run Knime without Knime Server
R scripting not loading on KNIME startup
how to import tables from .docx documents via R snippet
how to import tables from .docx documents via R snippet
How to run R script in KNIME?
R-scripting option in Preference
Feeding Knime data output into RStudio
#2

Thanks for this compilation! Very useful.

2 Likes

#3

Thanks for the write-up! As a short addition, on my Windows 7 (64bit) system, compilation of the Rserve package for R 3.6.1 (64bit) always failed until I called it like this:
install.packages("Rserve",, "http://rforge.net/", type = "source", INSTALL_opts = "--no-multiarch"))

2 Likes

Compiling Rserve 1.8-6 on Windows 7 (64bit)