Hello Holoviz Discourse, I am using a JupyterLab installation that does not have access to the internet. I am attempting to save some panel objects and holoviews plots with Bokeh backend as .png files, but producing an HTTP connection error. I’ve tried both panel.save() and hv.save() without luck. I tested saving a pure Bokeh example and I could produce a .png file successfully from a plot with export_png. Is there a way to save a plot as a .png file with panel’s .save() method or the hv.save() method while offline?
This is the error:
MaxRetryError: HTTPConnectionPool(host=‘localhost’, port=34951): Max retries exceeded with url: /session/863328be-4c41-4222-b580-ebd034595844/window/maximize (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x2af70006cd60>: Failed to establish a new connection: [Errno 111] Connection refused’))
I can post sample code but your example produces the same error I get when trying to save my examples. I think I updated bokeh and it resolved the HTTP max out error. But trying to save a png offline still is producing an error, and it seems related to this one and being offline. A side note is that I am able to export as html perfectly fine, but png really is preferable for my use case. Here’s the error:
I haven’t checked to see if I need to do anything extra to work offline, but running @riziles code in the following manner.
1 - restart jupyter lab kernel
2 - disable internet to laptop
3 - run code in jupyter lab cell; produces error
4 - reconnect internet to laptop
5 - re-run code in jupyter lab cell; works, saves file
6 - disconnect internet to laptop
7 - re-run code in jupyter lab cell offline; works, saves file, repeated multiple times no issues from there but…
8 - restart kernel, re-run cod in jupyter lab cell offline; back to failing and square one
I saw a bokeh issue from dev, it didn’t work from one dev version then worked on the next but was no actual resolve to what the issue is. Might be important to note this was on a linux fedora system utilising firefox.
Another approach that you could try would be to render the HoloViews object to a Bokeh Figure and then use the Bokeh export_png function if you say that is working for you.
Yes, I did get it working after your comments pointed me in the right direction - thank you! I was able to use the .get_root() function available on Panel objects to render as a bokeh figure, and then was able to successfully export the bokeh figure as a png with bokeh’s export_png. Appreciate your help!