☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Can't get export png to work in Bokeh 3.0.2

Community Supportbokeh
jeremy9959
jeremy9959

I can’t seem to export png plots under Bokeh 3.0.2.

$ bokeh info
Python version      :  3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0]
IPython version     :  8.6.0
Tornado version     :  6.2
Bokeh version       :  3.0.2
BokehJS static path :  /home/jet08013/anaconda3/envs/python310/lib/python3.10/site-packages/bokeh/server/static
node.js version     :  v14.15.4
npm version         :  6.14.10
Operating system    :  Linux-5.15.0-52-generic-x86_64-with-glibc2.31

Here’s my test code:

import numpy as np
from bokeh.plotting import figure
from bokeh.io import export_png

f=figure()
x=np.linspace(-10,10,100)
y=x**2
f.line(x=x,y=y)
export_png(f,filename='out.png')

I have firefox and geckodriver in my path:

~ > which firefox                                                                                 py python310 11:19:04
/home/jet08013/anaconda3/envs/python310/bin/firefox
~ > which geckodriver                                                                             py python310 11:20:05
/home/jet08013/anaconda3/envs/python310/bin/geckodriver

The same code works fine in my 2.4.3 environment.

Any advice?

and here’s the error message:

~ > python bokehexport.py                                                                         py python310 11:20:12
Traceback (most recent call last):
  File "/home/jet08013/bokehexport.py", line 9, in <module>
    export_png(f,filename='out.png')
  File "/home/jet08013/anaconda3/envs/python310/lib/python3.10/site-packages/bokeh/io/export.py", line 116, in export_png
    image = get_screenshot_as_png(obj, width=width, height=height, driver=webdriver, timeout=timeout, state=state)
  File "/home/jet08013/anaconda3/envs/python310/lib/python3.10/site-packages/bokeh/io/export.py", line 254, in get_screenshot_as_png
    web_driver = driver if driver is not None else webdriver_control.get()
  File "/home/jet08013/anaconda3/envs/python310/lib/python3.10/site-packages/bokeh/io/webdriver.py", line 135, in get
    self.current = self.create()
  File "/home/jet08013/anaconda3/envs/python310/lib/python3.10/site-packages/bokeh/io/webdriver.py", line 139, in create
    driver = self._create(kind)
  File "/home/jet08013/anaconda3/envs/python310/lib/python3.10/site-packages/bokeh/io/webdriver.py", line 157, in _create
    raise RuntimeError("Neither firefox and geckodriver nor a variant of chromium browser and " \
RuntimeError: Neither firefox and geckodriver nor a variant of chromium browser and chromedriver are available on system PATH. You can install the former with 'conda install -c conda-forge firefox geckodriver'.
⌁   Link to post
jeremy9959
jeremy9959

As far as I can tell, I have the latest version of both firefox (107.0) and geckodriver (0.32.0).

I’m not sure how to tell bokeh to prefer the chrome pathway. Is there a way to set that as an option or something?

⌁   Link to post
Bryan
Bryan

@jeremy9959 export_png accepts an explicit webdriver parameters, so you can pass it e.g. an instance of ChromeDriver that you create yourself manually. I don’t know if you are already familiar with that or not so I will wait to hear back before elaborating.

⌁   Link to post
jeremy9959
jeremy9959

I tried this with an explicit selenium webdriver instance and learned that the software was expecting the driver to be named “chromedriver” but for some reason conda installed it with the name “chromedriver-binary”. I symlinked this to “chromedriver” and now it works (without an explicit webdriver instance).

I’m not sure if this is a problem with wider implications or just some quirk of my installation.

Still not sure what the issue is with firefox.

Thanks for the help!

⌁   Link to post

End of archived discussion · Replies are disabled