Batch R_HOME does not exist

Hi,
I am unable to run a workflow in batch mode (Windows 11) containing a R node. The error message says it cannot find the R_HOME R-4.1.0 (see below the consolelog).
Actually I have installed R version 4.2.0 and the path in KNIME R preferences is C:\Program Files\ R\R-4.2.0.
The same workflow works well using the interface.

From the R console:

R.home()
[1] “C:/PROGRA~1/R/R-42~1.0”

Where is the R_HOME set in KNIME?

Thanks,
Alfredo

It is set in the preferences:

https://docs.knime.com/latest/r_installation_guide/index.html#installation

You can also try and install an R version via (Python) Conda Environment propagation and a YAML files. That way your R Snippet might always know where R is installed and has the necessary packages with it:

1 Like

Thanks @mlauber71,
I reinstalled both KNIME 4.6.3 and R (which is now at version 4.2.2) but nothing has changed.

Sys.getenv (c (“R_HOME”))
[1] “C: /PROGRA~1/R/R-42~1.2”

@alfroc these are two different paths. Have you checked the settings in KNIME? If that does not work you might want to try the environment propagation with R.

@mlauber71 ,

here’s what I get from these commands run interactively in an R node:

R.home(component = “home”) + sessionInfo()
[1] “C:/Program Files/R/R-4.2.2”
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252
[3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.2

How could I try the environment propagation in R? Any examples?

Thanks!

Maybe you can check the settings in KNIME preferences again. Also you can use this example to check your R settings.

You might want to check the link provided here:

Here is a basic example:

Hi @mlauber,
I set a Windows environment variable to R_HOME = C: \ Program Files \ R \ R-4.2.2, I also tried your suggestions and all the output correctly shows R-4.2.2 as root and home directory, but nothing changed.
I wonder why everything works well interactively but not in batch mode. Where could I find R-4.1.0 as R home? Hardcoded in some eclipse file? (I checked all the registers but didn’t find such value).
At this point unfortunately I have to give up… thanks anyway for your support!
Best,
Alfredo

@alfroc you might want to check the KNIME preferences …

And maybe also the idea with the Conda environment propagation (Data separate and melting - #9 by mlauber71) if that does not work. It will not be enough to have R running on the system. You will have to tell KNIME (and maybe the R node) where to find it.

Also there are two R integrations. The community one would need R(serve) to run outside before you use it. But I assume you have not used that.

Also the guide to KNIME and R is highly recommended if you have problems:

https://docs.knime.com/latest/r_installation_guide/index.html

Inside the file created with File → Export Preferences… ::
/instance/org.knime.ext.r.bin/knime.r.home=C:\Program Files\R\R-4.2.2

Pyton runs fine both interactive and batch.

1 Like

I solved the problem myself!
It is necessary to edit in the file org.knime.ext.r.bin.prefs which is in the directory C: \ Users \ (user) \ knime-workspace \ .metadata \ .plugins \ org.eclipse.core.runtime \ .settings
the R’s current home directory (in my case R-4.2.2, which was still set to R-4.1.0).

I’m still wondering why this problem only occurs in batch mode … @mlauber71

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.