R not able to call external tools (e.g. Orca)

I’ve been using the R integration in Knime for years now with minimal issues, but seem to run into problems when an R packages need to call a separate application via the Windows system PATH variable.

In this case, I am using the Plotly package, and want to save a static image of my chart. This is done by invoking the command-line tool Orca, which I have successfully installed and added to my system path. If I call Orca from an external R session (that is, not via Knime), it seems to work, but if I do the same thing from within an R View node in Knime (even using the exact same installation of R), I get the error message “The orca command-line utility is required for this functionality.”

In other words, R can see Orca if run separately, but not if it is run via Knime. I have a theory now that this is the same reason I could ever get R to see Pandoc, another external tool, many months back. (But I never thought to try invoking Pandoc from a standalone R session, and no longer have it installed. I just gave up.)

I’d be very grateful if anyone can report having run Orca or Pandoc from R within Knime, and to receive any suggestions for how to make it work.

Hi @AngusVeitch

When you run the next line in an R script it shows the PATH it’s using:
Sys.getenv("PATH")

In my R Source node it does not show the contents of the PATH which I see in a CMD-box.

A next line to your R script will change this PATH variable
Sys.setenv(PATH = paste0(Sys.getenv("PATH"), ";C:\\your_dir_to_orca"))

This should make it possible to find the required application again.

3 Likes

Thanks @JanDuo, that seems to have fixed that error! Only problem now is that I have a new one, presumably thrown by Orca itself:

I don’t know how to decode this, but will try looking in forums more specific to Orca (assuming you don’t have any ideas).

Thanks again!

Hi @AngusVeitch
It looks like it cannot find mkdir, which is a standard windows command. Maybe you have to add more directories in your R-script (like C:\Windows\system32)?
You might even have to copy the complete PATH directly into the R-script?

Thanks @JanDuo, I added System32 (and some other things that looked relevant, but not everything yet) to the PATH additions but that didn’t solve it. Apparently the mkdir command is built in to the Windows shell and not stored separately, so I’m not sure how to direct Orca or R to it.

Google finds a few discussions of similar looking issues, but nothing that can help me so far. I will report back if I find a solution.

2 Likes