plotly / orca

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

Google Colab: Orca - Plotly xvfb property set to True, but the xvfb-run executable could not be found on the system path. #384

Open MarkKrickovich opened 2 years ago

MarkKrickovich commented 2 years ago

I am receiving a Path Error using Orca in Google Colab to save an image in a Google Colab .ipynb Python Machine Learning model. A Flask App (written in VS Code IDE) uses the Colab trained model to output results to a URL. To be clear, the errors occur in my Colab Python script. This error is very similar to issue #252, however, I am unable to recreate the solution used there.

I Colab, I have created the following recommended import lines, as described in many posts:

!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 and import plotly.graph_objects as go

I then use the following image write command: fig.write_image('base_pic.svg') I expect to see 'base_pic.svg' appear as a file when the code runs, but this is not happening.

My error seems to related to a path setting, however, I am unable to find detailed instruction to update and correct this path. Unfortunately, I am quite novice with troubleshooting paths.
The Error:

ValueError Traceback (most recent call last)

in () 1 #TEST FUNCTION ----> 2 make_picture('AgesAndHeights.pkl',model, floats_string_to_np_array('1, 3, 3.2, '),'x.svg') 5 frames /usr/local/lib/python3.7/dist-packages/plotly/io/_orca.py in validate_executable() 1109 Searched for the executable 'xvfb-run' on the following path: 1110 {formatted_path}""".format( -> 1111 formatted_path=formatted_path 1112 ) 1113 ) ValueError: The plotly.io.orca.config.use_xvfb property is set to True, but the xvfb-run executable could not be found on the system path. Searched for the executable 'xvfb-run' on the following path: /usr/local/nvidia/bin /usr/local/cuda/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin

My SetUp: Windows 10 VS Code to run a Flask app Google Colab to host the ML model Python 3.9.7 used via Anaconda

I have noted several discussions where users recommend using Kaleido instead of Orca, and I am using Kaleido within the Flask app, however, I do not believe Colab supports Kaleido. Is this correct?

Any help would be welcomed. Mark