The SaveTool and
export_png do not share anything in common. The save tool generates a data URL directly from the HTML canvas. The Python export functions use a Selenium webdriver to drive a headless browser to generate the image to save. Are you sure you are giving the correct full path to the
phantomjs executable binary? To be explicit, the required path ends in “phantomjs”, and is not a directory. Are you actually able to run the
phantomjs program yourself? E.g. what is the output of
phantomjs --version? If that does not work, then that is the problem (but that is a problem outside Bokeh).
Otherwise, all I can suggest is that you pass use the low level function with a webdriver you create and configure manually.
Something like (untested)
from selenium import webdriver
from bokeh.io.export import get_screenshot_as_png
from bokeh.resources import INLINE
driver = webdriver.PhantomJS(executable_path="/full/path/to/phantomjs")
get_screenshot_as_png(plot, driver=driver, resources=INLINE)
Any workaround available to invoke from tool?
I mean, in principle, but you would need a working Selenium and a headless webdriver to do it, and that is already the issue.
I’ll just state that it’s also entirely possible that there are simply limitations on colab that are out of our control. E.g.
push_notebook does not work on colab because colab blocks the necessary websocket APIs. Apparently that restriction has finally been lifted after several years, so that we can maybe make
push_notebook work in the near future. But I can’t say what other differences and inconsistencies there are with standard notebooks, that might affect other things.