Install R alongside KNIME on Windows and MacOS

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

18 Likes

Thanks for this compilation! Very useful.

2 Likes

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

A comprehensive installation guide can be found here.

R installation guide

If youā€™re still experiencing problems please donā€™t hesitate to contact us!

Best
Mark

1 Like

The script works well for MacOS. I found two things I had to change/remember:

R_VERSION=4.0.0

On Windows you would have to install a new version of RTools in oder to get R 4.0 up and running
https://cran.r-project.org/bin/windows/Rtools/

2 Likes

This post made my life so much better. Thank you so much for taking the time to write this out and share.

4 Likes

This article from 2019 tried to bring together all the information I had about installing and using R with KNIME on Windows and MacOS. Since then there have been some developments so I moved to the hub and wrote a hopefully useful guide - taking into account things like the new official guide by KNIME and the very helpful script to install homebrewe on MacOS in order to get RServe up and running.

I also tried to show some path how to approach problems with R and KNIME.

I will continue to update the hub entry to keep up with new developments:

3 Likes