Plotly Orca Bug and Workaround

TLDR: solution thread at https://stackoverflow.com/questions/58473837/plotly-missing-orca

I love plotly. I never remember any of their syntax when generating images and have to search every single time but they produce easily some of the most gorgeous graphs if you spend a few minutes, maybe hours, or days obsessing over the details and produce stunning images. I absolutely adore it for visualization.

However, Plotly has an unreliable dependency/connection with Orca. It is a PITA in the most utter, frustrating thing to work with and I struggled to solve it literally over span of months across dozens of computers and never managed to get it working… until now.

So, ORCA https://github.com/plotly/orca is the component that MUST be installed and does some black voodoo Javascript/NodeJS magic just so that… you can programmatically save the image generated in Plotly (at least, I believe that is its primary function). Yup. or you can just click on the button to save the image. However, this gets tedious when you have many images to save…

So in theory, it is easy as pie. Install, add binary to path, if not, run

plotly.io.orca.config.executable = '/path/to/orca' 

and everything should work. Except, it never worked across the half dozens of computer I tried on windows. In my jupyter notebook, I can even launch !orca but for some bizarre reason, the plotly fails to find ORCA executable WHILE printing out the path in the debug prompt. The fact that I POINT it to it via command above, still fails. Impressive…

So I thought I was special and must be something with my machine/env/windows/. Then I search and saw quite a few thread that leads to no where…

Eventually, I found the solution thread for ME at least: https://stackoverflow.com/questions/58473837/plotly-missing-orca. I need a shrine built for the user Susanna Ventafridda for finding this out.

In short, a MANUAL tweak to the Plotly package and alter the function call to WHICH will help find the package.

Not sure if this is a windows only issue or not. However, after MANUALLY updating that path to point to the orca.exe, it works for me at least… Don’t forget the r infront of the path string.

PS: Some additional annoyance I noticed right away:

  • Saving first image takes a few seconds to spin up the orca node server I presume on modern work stations…. oh the wonder of Javascript performance… for the task for saving an image… sigh.
  • fig.write_image() does not take Path… yeah… you have to pass it string path information. I feel dirty.