bokeh app get disconnected when using export_png


In my Bokeh app, I tried to save the plots to png files and use them later for presentations. However, I found the following error due to “export_png” statement:

2018-08-18 12:19:06, 766, Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’(urllib3.connection.HTTPConnection object at 0x00000000009FAFDD8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it’,)’: /wd/hub/session/f4c09870-bb5f-11e8-b9d4-b77db4c74e4d

before I hit a button to do the export_png, everything runs OK, once the App starts to export_png to a file, the console shows repeating error message showing above.

It did no stop the App. After a while the program continued, but it did not save all the png files as it should in the program.

I tested export_png separately and I noticed it is very slow (taking more than 10 seconds for a very simple line plot), and it is similar if I use export_svg. Eventually, it is due to the get_screenshots_as_png is very slow.

I wonder if anyone has such problems before and If there are solutions to this problem.

Thank you very much.