I want to create graphs in Python with Plotly and process them further as bytestreams. While working on this i read about static image generation here https://plot.ly/python/static-image-export and saw that
orca is a needed dependency.
Do i also need
orca if i don’t want to create the image itself but just the bytestream? I guess yes and if so, isn’t there any other way to do it?
Orca is huge and i’d like to avoid using it if possible.
If you’re setup with an account for online plotting (https://plot.ly/python/getting-started/#initialization-for-online-plotting) you can use
plotly.plotly.image to request the image bytes.
from plotly.plotly import image
img_bytes = image.get(fig)
But if you’re working offline, the orca is the best option.
Hope that helps!
Well, i guess i will have to use it then
Thank you for the help!
hi @jmmease , is there any way to install orca in an app environment such as Heroku or Google App Engine? These platforms normally only support pip installs (through requirements.txt) or pre-installed modules by cloning a git repository (but this last option would be difficult as it would be needed some research about how is the OS of the server)
I’m very much interested in generating static images or image bytes from a platform like that, but orca seems a big limitation
Does the second option you stated (using
plotly.plotly.image for image bytes) consume Plotly online graph quota?
EDIT: ok, I just checked your option, which works fine, but it’s limited to 100 exports daily, unless upgrading quota, and it is not as fast as I would like (as it involves a call to your servers)
Please let me know if you have any solution for avoiding Orca or installing it on Heroku/Google App Engine
I don’t personally have much experience with Heroku or Google App Engine, so I can’t say for sure what the best approach is to get orca installed there. Here’s a conda buildpack for Heroku that might be worth looking into: https://elements.heroku.com/buildpacks/conda/conda-buildpack. Or perhaps you could use the
npm install approach (https://devcenter.heroku.com/articles/deploying-nodejs#declare-app-dependencies).
Also, I expect that you’ll need to follow the Headless server configuration instructions on these platforms since they probably won’t have an x-server configured.
plotly.plotly.image approach, yes the number of conversions does depend on your chart studio account.