I have gone through through that guide and the linked posts as well, I can’t find the issue though.
I have the latest version of Rserve and Cairo installed, I have uninstalled and reinstalled the Knime packages for R as well. I am running Windows 10 64 bit. I am able to get some of the community R nodes to work by starting Rserve in Rstudio, however the nodes hang at ‘Executing - Transfer to R’ for anything other than very basic scripts. The R nodes from Knime won’t run at all due to the ‘R cannot be initialized error’.
Maybe you could construct a small example and try to run it with the generic R nodes of KNIME. You could clear your log file before and then post this log file here so we might have a look about what is going on.
And maybe you could post a screenshot of your KNIME settings as well. And also you might post the small test workflow you are using so we see if there are any hints. How large is the initial file?
Typical additional culprits - besides the initial setup (which in most cases is the problem):
There is one line in the log file that hints to some strange configuration of the RServe.exe. It could have to do with the path where R stores its libraries/packages.
Caused by: java.io.IOException: Command not found: \/Users$/JamesOllier/Documents/R/win-library/3.5/Rserve\libs\x64\Rserve.exe
Maybe you could run
.libPaths()
The you could check which version of RServe you have running
packageVersion("Rserve")
and see if there is more than one.
You could show us your R settings like this (screenshot is from a Mac):
At a first glance the settings look good but this part worries me and may have to do with the problem - also the log file hints in that direction.
/Users$/ for me does not look like a valid path and I am not sure if you can access this directory. And also the question is if the Rserve is stored there or in the other location.
Could you check out what is going on with this path and if you are able to remove it. I have to look up how to handle that.
For anyone else encountering this problem (“R cannot be initialized”), it certainly can be related to the path name where Rserve is installed.
I am using KNIME 4.1.0 with R 3.6 on Windows 10 64-bit.
I don’t have access to write to the C:/ drive and use a mapped drive to host my packages. I got the same error as @JamesOllier in java (Caused by: java.io.IOException: Command not found: path-to-Rserve\Rserve.exe). Even though I changed my .libPaths() in R to direct to a path such as “D:/path-to-win-library/” and installed Rserve to that library, KNIME tried to load Rserve using the server name (e.g. \\server), since the server name uses backslashes, it need multiple escape slashes, however only one backslash was loaded as the server path name (e.g. \server\path-to-Rserve\Rserve.exe instead of \\server\path-to-Rserve\Rserve.exe) and therefore the Rserve.exe file could not be loaded.
For me the solution was to get access to place Rserve in my library folder under the R installation (on the C:/ drive).
package ‘Rserve’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\nzr\AppData\Local\Temp\RtmpaEl0Z6\downloaded_packages
Although it installs, I keep getting the error message that R cannot be initialized when I am trying to use the R readxls node in Knime.
This is the first time I try using an R node, and I know almost nothing about R other than the fact that a node exists that can read a large xlsx file so I can take that table and write it to SQL Db. Any help with this would be stellar.
@noemireyes since problems about KNIME and R occur on a frequent basis I have compiled a collection about documentations and additional things you will most likely have to try. You will have to comile RServe 1.8.6 on your machine and use RTools to do that. You will find the necessary links here:
Hi @mlauber71, I have gone through the full guide and have tried all of these steps and still get the following error message.
ERROR R Source (Table) 0:84 Execute failed: Exception occurred during R initialization.
I am running R 4.0.2 with Windows 64 bit and KNIME 4.2.1 rServe is 1.8.7 ( and has been verified in R) the library has also been transferred over. The default R location is set in KNIME, and when I try using any R node, I get the same error.
@noemireyes could you try to run this workflow and see what the results are.
Have you checked what the settings are in the KNIME preferences. Are there any error messages?
Then the passages in the Log about WindowsDefenderExceptionHandler sound ominous. Could it be that you experience problems with a virus scanner?
And is your R and KNIME on a local installation/machine or maybe on some remote or virtual drive.
Then you could check if you could start and stop RServe outside KNIME from RStudio for example. This would be used with the R community nodes, but just to make sure.
I tried so much of what you shared. Thank you @mlauber71!
I ended up uninstalling R, R Studio, Rtools, and KNIME. I followed the install instructions once again ( making sure I was doing so as an administrator) and immediately saw a change in the error messages.
One thing I did differently this time is selecting the options to only install only the 64bit versions. The other strategy was to run R & R Studio as an administrator and changing the library paths to the R home folder before installing any packages.
After Compiling Rserve using @mattflor’s instructions, I loaded Rserve. It took some time to figure out there are a few steps to run before I start working in KNIME and I found that here , this turned out to be a critical step for me. I was able to run the workflow you linked above and I also ran the R_Intro_1 workflow (Intro_to_R_in_Knime). This workflow requires additional packages to be installed and once they were installed, I got green lights all the way!
I am fairly new to KNIME and a newbie to R, so this was definitely an exercise in patience over many days… 7 DAYS! Sticking with it was rewarding. I really hope this helps future learners.
Thanks again for your help with this matter.
Glad it worked in the end. That is my experience with a lot of things concerning data analytical problems. You have to stick to it and be relentless until you achieve victory
Your observations with the Paths and the admin rights and so on is very interesting. I will include them in the collection.
One of my teammate also faced the same issue of R not initialized, she has missed to install additional packages like Rtools, RServe, etc. I remember when i had the same issue, i gone through the forum and found very useful posts from others, especially @mlauber71 (thank you so much for this) and with my experience i was able to guide her and succeeded.