plotly / orca

Command line application for generating static images of interactive plotly charts
MIT License
293 stars 40 forks source link

Orca on rStudio - Command 'orca' not found @win/processx.c:983 #331

Open AMillanFL opened 4 years ago

AMillanFL commented 4 years ago

Hello,

Trying to use orca on Rstudio 1.3.959 (windows 10, R-4.0.0) after the simple command :

p <- plotly::plot_ly(data = dispersion.freq, x = ~FREQUENCY, y = ~var_RS)
plotly::orca(p, file = "image.png")

I have this error message

Error: <c_error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  ...:
 Command 'orca' not found @win/processx.c:983 (processx_exec)>

 Stack trace:

 1. plotly::orca(p, file = "image.png")
 2. plotly:::orca_available()
 3. plotly:::correct_orca()
 4. processx::run("orca", "-h")
 5. process$new(command, args, echo_cmd = echo_cmd, wd = wd, windows_verbatim_args = windows_verbatim_args,  ...
 6. .subset2(public_bind_env, "initialize")(...)
 7. processx:::process_initialize(self, private, command, args, stdin,  ...
 8. rethrow_call(c_processx_exec, command, c(command, args), stdin,  ...

 x Command 'orca' not found @win/processx.c:983 (processx_exec) 

In bash command line when I call orca lihe this orca graph "{ \"data\": [{\"y\": [1,2,1]}] }" -o fig.png every thing works fine.

I don't understand the Command 'orca' not found @win/processx.c:983 error message.

Many thanks for your lights.

okhoma commented 4 years ago

By default, when orca is installed using conda, only orca.cmd is available on PATH. And when you run orca in command line it is found by the shell. But when you run plotly::orca() it uses processx::run() which, in turn, uses CreateProcessW and this function does not support running command files.

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw

To run a batch file, you must start the command interpreter; set lpApplicationName to cmd.exe and set lpCommandLine to the following arguments: /c plus the name of the batch file.

The workaround is to add folder with orca.exe to PATH. But, ideally, on Windows, R orca library could check if orca.cmd is available and then change command line, or run orca in some other way.