R cannot be initialized

#1

Hi,

I am encountering the above error in Knime when trying to use the R nodes.

I think I have all the necessary packages installed in R and in Knime.

This is what I can see in the log:

R Output Reader : RBinUtil : : : External Rscript process output:
R Error Reader : RBinUtil : : : External Rscript process error output:

Does anyone have a solution? I am running 3.7.1.

Thanks

0 Likes

#2

Hi there!

Welcome to KNIME community!

There is a great topic regarding installing and running R with KNIME so check it out :wink:

Br,
Ivan

2 Likes

#3

Thanks,

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’.

0 Likes

#4

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):

  • very complex paths with special characters
  • no rights to write in certain areas
  • virus scanners
  • virtual hard drives and slow network IO
  • several processes trying to access R at once
0 Likes

#5

I have attached the log and an example workflow, it’s just an R snippet node.
Which settings would you like to see?

Thanks
knime.log (393.4 KB)
R Example.knwf (5.1 KB)

0 Likes

#6

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):

0 Likes

#7

Hi,

This is what I see running those commands:

.libPaths()
[1] “/Users$/JamesOllier/Documents/R/win-library/3.5” “C:/Program Files/R/R-3.5.2/library”
packageVersion(“Rserve”)
[1] ‘1.8.6’

These are my R settings in Knime:

Thanks

0 Likes

#8

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.

2 Likes

#9

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).

2 Likes

#10

Hi there @alexga,

tnx for chipping in with nice explanation and your solution! And welcome to community :wink:

Br,
Ivan

0 Likes