KNIME and R — installation across operating systems — some remarks
(a newly condensed article)
https://medium.com/p/dcf0efdc8ddf
----------------
A meta collection and article about R and KNIME
R gives you the power to do a lot of great things combined with KNIME but to get R and KNIME together up and running can be a challenge. I came across a lot of questions about this over the year and wrote a summary article back in 2019 *1). I will try to give you the most helpful links and adress the most basic pitfalls. Most of this is related to Windows (10) and MacOS.
Keep in mind you will need these components to get KNIME and R to work together
- a working KNIME installation with R scripting nodes (the official version)
https://hub.knime.com/knime/extensions/org.knime.features.r/latest
- a working version of R - use the official guide and just install the binaries *1) or the Environment propagation *1a) or explore the possible challanges *1b)
- R & KNIME will need RServe >=1.8.6 - there is *no* way around this. You *have* to make this work! And some other libraries like Cairo
- compilation (if necessary) on Windows will need RTools *2)
- compilation (if necessary) on MacOS will need Homebrew and some other tools possibly *3)
- you have to configure the whole thing to make it work
For starters follow the official installation guide - if that works you are done, perfect
https://docs.knime.com/latest/r_installation_guide/index.html
*1) On Windows or MacOS you might be able just to install the latest RServe binary version (1.8-10) with this commands:
install.packages("Rserve", repos = "https://cran.r-project.org", type="win.binary")
install.packages("Rserve", repos = "https://cran.r-project.org", type="mac.binary")
see: https://forum.knime.com/t/r-integration-cannot-install-rserve/38785/2?u=mlauber71
--- you can install a specific package directly (check for the latest releases on: https://cran.r-project.org/package=Rserve)
install.packages("https://cran.r-project.org/bin/windows/contrib/4.1/Rserve_1.8-10.zip", repos = NULL, type ="win.binary")
install.packages("https://cran.r-project.org/bin/macosx/contrib/4.1/Rserve_1.8-10.tgz", repos = NULL, type ="mac.binary")
--- on Windows you can also use the installr package:
# install.packages("installr")
library(installr)
install.packages.zip("https://cran.r-project.org/bin/windows/contrib/4.1/Rserve_1.8-10.zip")
-----------------------------------------------------------------------------------------------
*1a) the Conda Environment Propagation can be used to install a (typically slightly older) R version via Anaconda or Miniconda for KNIME
https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_r_basic_knime_in_out_flow_variable~119aEydIH0oCdht8
=> the benefit would be you are also set up for Python (https://kni.me/w/AvjrddXKOIoZYLV3)
*1b) Install R alongside KNIME on Windows and MacOS (from 2019 but contains maybe useful links and explanations)
https://forum.knime.com/t/install-r-alongside-knime-on-windows-and-macos/13287?u=mlauber71
If you want to see what you can do with KNIME and R you could explore my workspace and serach for workflows beginning with kn_example_r_<...>
https://hub.knime.com/mlauber71/spaces/Public/latest/~sl4rYEzjFPm7a99a/
KNIME and R ggplot2 – „the beautiful Violin Plot that has it all“
https://forum.knime.com/t/knime-and-r-ggplot2-the-beautiful-violin-plot-that-has-it-all/38224
https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_r_violinplot_boxplot~DZP837sduxJ8yC-t
-----------------------------------------------------------------------------------------------
If you still encounter problems these links about R and RServe 1.8.6 are most likely to help you on the way.
*2) ------------------------- (only if your R is not up and running with the above points)
RServe 1.8.6 on Windows
https://forum.knime.com/t/compiling-rserve-1-8-6-on-windows-7-64bit/18318?u=mlauber71
https://forum.knime.com/t/how-i-finally-got-r-working-in-knime-on-windows-10/22491?u=mlauber71
If you (still) struggle to get RTools working on Windows you can follow this thread
https://forum.knime.com/t/how-to-import-tables-from-docx-documents-via-r-snippet/19284/10?u=mlauber71
Using Rtools40 on Windows
https://cran.r-project.org/bin/windows/Rtools/index.html
Some more recent hints about R, RStudio and usage of admin rights and library path by noemireyes
https://forum.knime.com/t/r-cannot-be-initialized/14836/15?u=mlauber71
*3) ------------------------- (only if your R is not up and running with the above points)
RServe 1.8.6 on MacOSX
=> for Mac users please note there is a passage in the official guide about a script you will have to run to install "Homebrew".
It is eays to miss that but it might be very vital:
https://forum.knime.com/t/install-r-alongside-knime-on-windows-and-macos/13287/5?u=mlauber71
https://forum.knime.com/t/how-i-finally-got-r-working-in-knime-on-windows-10/22491/6?u=mlauber71
https://bitbucket.org/KNIME/knime-r/src/master/org.knime.r/scripts/
If you still encounter problems on MacOS refer to these articles:
https://forum.knime.com/t/knime-r-integration-execute-failed-exception-occured-during-r-initialization/23016/6?u=mlauber71
https://forum.knime.com/t/installing-rserve-1-8-6-on-macos-10-15-catalina/20909/6?u=mlauber71
If you encounter problems with messages that R cannot find the XQuartz.app you might have to re-activate or rebuild your MacOSX Spotlight index for the folder
https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/7?u=mlauber71
-----------------------------------------------------
If you want to ceck the status of your R installation you could use this node
https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_r_check_version_of_package
=> if this produces unwanted or 'funny' results you will have to resort to some of the measures above
-----------------------------------------------------
And then if you want to keep your R clean and updated here are two ways to do it. best to do it from RStudio or R GUI itself.
3 Methods to update R on RStudio (for Windows & Mac)
https://www.linkedin.com/pulse/3-methods-update-r-rstudio-windows-mac-woratana-ngarmtrakulchol/
Updating R from R (on Windows) – using the {installr} package
https://www.r-statistics.com/2013/03/updating-r-from-r-on-windows-using-the-installr-package/
-----------------------------------------------------
If you must you could start RServe outside of KNIME (in RStudio) - this is necessary for the Community nodes of R
https://forum.knime.com/t/r-source-community-node-connection-error/13087/2?u=mlauber71
R Community nodes (I would *not* recommend using them in the first place)
https://nodepit.com/category/community/r
library(Rserve)
library(RSclient)
Rserve(port = 6311, debug = FALSE, args = “–vanilla”)
# start the RServe(er)
rsc <- RSconnect(port = 6311)
# shutdown the server after you used it
RSshutdown(rsc)
-----------------------------------------------------
External resources
- Medium: KNIME and R — installation across operating systems — some remarks
- R - RServe 1.8-10 - install binary files on Windows and MacOS
- If you want to see what you can do with KNIME and R you could explore my workspace and serach for workflows beginning with kn_example_r_<...>
- (official) for starters follow the official R installation guide - if that works you are done, perfect
- the Conda Environment Propagation can be used to install a R version for KNIME
- If you encounter problems with messages that R cannot find the XQuartz.app you might have to re-activate or rebuild your MacOSX Spotlight index for the folder
- Some more recent hints about R, RStudio and usage of admin rights and library path by noemireyes
- If you must you could start RServe outside of KNIME (in RStudio) - this is necessary for the Community nodes of R
- Updating R from R (on Windows) – using the {installr} package
- 3 Methods to update R on RStudio (for Windows & Mac)
- if you want to check the status of your R installation you could use this node
- If you sill encounter problems on Mac refer to these articles (2)
- If you sill encounter problems on Mac refer to these articles (1)
- RServe 1.8.6 on MacOSX (2)
- RServe 1.8.6 on MacOSX (1)
- Using Rtools40 on Windows
- If you (still) struggle to get RTools working on Windows you can follow this thread
- RServe 1.8.6 on Windows (2)
- RServe 1.8.6 on Windows (1)
- Install R alongside KNIME on Windows and MacOS (from 2019 but contains maybe useful links and explainations)
Used extensions & nodes
All required extensions are part of the default installation of KNIME Analytics Platform version 4.7.8
No known nodes available
Legal
By using or downloading the workflow, you agree to our terms and conditions.