bokeh / bokeh

Interactive Data Visualization in the browser, from Python
https://bokeh.org
BSD 3-Clause "New" or "Revised" License
19.27k stars 4.18k forks source link

[BUG] Bokeh trying to use chromedriver when geckodriver installed. #10331

Open birdsarah opened 4 years ago

birdsarah commented 4 years ago

I have followed the instructions here: https://docs.bokeh.org/en/latest/docs/user_guide/export.html?highlight=export

And conda installed firefox, geckodriver, selenium.

When trying to export_png, I get the following error:

~/miniconda3/envs/braid/lib/python3.7/site-packages/bokeh/io/export.py in get_screenshot_as_png(obj, driver, timeout, resources, width, height)
    202         web_driver.maximize_window()
    203         web_driver.get("file:///" + tmp.path)
--> 204         wait_until_render_complete(web_driver, timeout)
    205         [width, height, dpr] = _maximize_viewport(web_driver)
    206         png = web_driver.get_screenshot_as_png()

~/miniconda3/envs/braid/lib/python3.7/site-packages/bokeh/io/export.py in wait_until_render_complete(driver, timeout)
    294     except TimeoutException as e:
    295         _log_console(driver)
--> 296         raise RuntimeError('Bokeh was not loaded in time. Something may have gone wrong.') from e
    297 
    298     driver.execute_script(_WAIT_SCRIPT)

RuntimeError: Bokeh was not loaded in time. Something may have gone wrong.

When I run debug, the driver bokeh is trying to use is chromedriver.

Screenshot from 2020-07-24 18-29-11

I do also have chromedriver on my path, but not in my conda environment.

After uninstalling chromedriver from my global path, things worked as expected. Not exactly sure what a good solution is here. It's a conflict between my conda environment and the global...

mattpap commented 4 years ago

What we could do is to check which browser/driver appears earlier on $PATH, and attempt to use drivers in that order. Conda prepends itself to $PATH, so that would work with it. Currently we try to detect chromium-based browsers first and then firefox.

bryevdv commented 4 years ago

Is this a dupe of https://github.com/bokeh/bokeh/issues/10108?

birdsarah commented 4 years ago

Is this a dupe of #10108?

No. After uninstalling chromedriver everything worked fine. As @mattpap said it's because the codepath currently just tries chromium first rather than using $PATH as precedence.

bryevdv commented 9 months ago

@mattpap any idea if this is still an issue? There's been quite a bit of refactoring of the webdriver code in the last few years IIRC.

mattpap commented 9 months ago

any idea if this is still an issue? There's been quite a bit of refactoring of the webdriver code in the last few years IIRC.

That's a possibility, but needs to be verified.