plotly / orca

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

Orca executable in Colab not recognized #290

Open connerpate opened 4 years ago

connerpate commented 4 years ago

I have been using orca to export .svg images of charts generated in Google Colab via Plotly to my Google Drive. This worked perfectly until late last week, when I started getting an error message saying that the orca executable I install in a Drive location as part of the notebook setup was not "a valid plotly orca executable" whenever I ran code to generate/export the chart.

Below is the full error text:

_ValueError Traceback (most recent call last)

in () 39 if output_plots: 40 file_name = output_folder + '/' + 'NeighborhoodProfiles_TotalPopulations.svg' ---> 41 fig.write_image(file_name) 4 frames /usr/local/lib/python3.6/dist-packages/plotly/io/_orca.py in validate_executable() 1182 for more info on Xvfb 1183 """ -> 1184 raise ValueError(err_msg) 1185 1186 if not help_result: ValueError: The orca executable is required in order to export figures as static images, but the executable that was found at '/content/orca-1.2.1-x86_64.AppImage' does not seem to be a valid plotly orca executable. Please refer to the end of this message for details on what went wrong. If you haven't installed orca yet, you can do so using conda as follows: $ conda install -c plotly plotly-orca Alternatively, see other installation methods in the orca project README at https://github.com/plotly/orca After installation is complete, no further configuration should be needed. If you have installed orca, then for some reason plotly.py was unable to locate it. In this case, set the `plotly.io.orca.config.executable` property to the full path of your orca executable. For example: >>> plotly.io.orca.config.executable = '/path/to/orca' After updating this executable property, try the export operation again. If it is successful then you may want to save this configuration so that it will be applied automatically in future sessions. You can do this as follows: >>> plotly.io.orca.config.save() If you're still having trouble, feel free to ask for help on the forums at https://community.plot.ly/c/api/python Here is the error that was returned by the command $ /content/orca-1.2.1-x86_64.AppImage --help [Return code: 1] Note: When used on Linux, orca requires an X11 display server, but none was detected. Please install Xvfb and configure plotly.py to run orca using Xvfb as follows: >>> import plotly.io as pio >>> pio.orca.config.use_xvfb = True You can save this configuration for use in future sessions as follows: >>> pio.orca.config.save() See https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml for more info on Xvfb_
emmanuelle commented 4 years ago

Hi @connerpate maybe the solution described in https://stackoverflow.com/questions/57262385/saving-or-downloading-plotly-iplot-images-on-google-colaboratory/57272111#57272111 can help.

ghuba commented 4 years ago

Same error here. The link above on StackOverflow does not provide instructions that worked for me. The error message I have is:

ValueError: 
The orca executable is required in order to export figures as static images,
but the executable that was found at '/usr/local/bin/orca'
does not seem to be a valid plotly orca executable. Please refer to the end of
this message for details on what went wrong.

That's on Google colab.

1382Lubster commented 4 years ago

#######Try with installing these packages on Colab:

!pip install plotly==4.7.1 !wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O /usr/local/bin/orca !chmod +x /usr/local/bin/orca !apt-get install xvfb libgtk2.0-0 libgconf-2-4 import plotly.graph_objects as go

Then generate your figure- not including code here
Save the figure as:

fig.show() fig.write_image("figname.png")#change format if needed

Or save the generated figure on Google drive as:

fig.show() fig.write_image("gdrive/My Drive/destinationfolder/figname.png")

ghuba commented 4 years ago

Did you try saving in svg format? I feel png is the default format in plotly and it may not require orca. I could try to rerun your code but I am pretty sure this is what I did. The orca executable could not be run correctly for me. Let me know if svg works. It's a much better format.

rlphillips commented 4 years ago

Hello! To add to this discussion, I've tried both the solutions described by @1382Lubster and @emmanuelle . The executable seems to install correctly, but apparently there's a communication error between the orca server . I'm assuming there's a firewall issue, maybe? I wasn't able to make it work in Colab.