Missing geckodriver and/or firefox (but they are in PATH)

I have installed selenium via pip3.7 (no conda here) to be able to export_png, but

  File "/home/pi/.local/lib/python3.7/site-packages/bokeh/io/webdriver.py", line 140, 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'.

but I do have them

$ which firefox
/usr/bin/firefox
$ which geckodriver
/home/pi/bin/geckodriver

I have also tried different versions in different locations, e.g.

$ which geckodriver
/usr/local/bin//geckodriver

somehow Boekh is not seeing it/them. Any tips or hints on how to gain more insight on what is not seen by bokeh (firefox or gecko)?

I am on raspbian, if that matters and this bokeh 2.1.1
Thanks,
Roberto

PS
On OSX this went all fine and export_png works very well.

Just to add that I have removed selenium and reinstalled firefox, but this has not brought any improvement. I have also updated bokeh, just in case, no good.

This is happening on a headless machine, so I had not noted it before, but I have realized that despite the complaint that firefox and/or geckodriver are missing, a firefox window is opened on this machine! (and bokeh is not even caring to close ti afterwars)

    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'.
r $ which firefox
/usr/bin/firefox
 $ ps -e | grep firefox
25795 pts/9    00:00:25 firefox-esr

Upon further inspection the firefox I was getting open was not able to open the requested webpage. I tried a simple script to debug this.

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('http://www.google.com/');

This made me suspect. I have realized that there is a version-match need for all these to work, so the best might be to get chrome-browser and its driver from apt.

sudo apt-get install chromium-browser
sudo apt-get install chromium-chromedriver

so that they will be same version and are going to be Raspbian compatible ( armhf 72.0.3626.121-0+rpt4 version at the time of writing).

The webdriver and browser definitely need to be a compatible version pair. If there is some way to programmatically determine this, we could potentially check and warn, but that’s about the best we could do (it’s out of our hands what versions users install)

Thanks for chiming in.

I know that when it comes to external resources dependences, such as browser and its command-line interface, it is hard to have something working for all situations, but, yes, it would help a lot to throw some more informative message.

E.g. it would help to know what combination of firefox&gecko or chromium-browser+chromedriver was attempted, including which one resulted in not being a valid executable. Of course the user need to figure it that is because software is not installed or not in path.

After fixing this one machine yesterday, today I had another nightmare with it :frowning:
In this case it was some RAM allocation that limited the opening of chromium. Ok, that is pretty system-specific, I do not want bokeh guess that my RapberryPi memory is quite limited. Still it took a while to troubleshoot and only after I tried to launch chromium it became obvious there was an issue at the root (not depended on bokeh, that I had fixed yesterday). So, if we were shown the actual error messages (e.g. chromium not in PATH, chromedriver not in PATH, chrome crashed with this error message), it would be much helpful and debug will be easier - my 2 cents.

Thanks for reading.
Roberto

Hi
I am also getting this issue on a headless linux(Ubuntu 18). I have tried uninstalling and reinstalling

sudo apt-get install chromium-browser
sudo apt-get install chromium-chromedriver
sudo apt-get install  firefox-geckodriver

also I reinstalled Bokeh and Selunium.

I am unsure what is meant about getting the Versions matching. Is there a configuration file in bokeh that needs to be amended to point to the right directory?

From the command line it seems that firefox is installed. Is there any good tutorials on how to implement this. I am at a bit of a loss.

Thanks in advance if anyone has any ideas.

Some versions of chromedriver only work with certain versions of of the Chrome browser. If the installed version of chromedriver is not compatible with the installed version of Chrome, then it will raise a loud error. As I mentioned above, this is not anything under our control or that we can do anything about, because we have no control over what users install.

I am afraid I don’t know what it is causing the trouble in your situation. In case it is helpful, the conda environment files we use to set up CI environments for testing (including installing chromedriver) are here:

bokeh/ci at branch-2.4 · bokeh/bokeh · GitHub

Evidently Github Ubuntu 20.04 images install Google Chrome version 89.0.4389.114

Thank you for taking the time to reply. Love Bokeh.
I checked my versions I am running and they all seemed to be matched and fine.

What solved the issue was

sudo ln -s /usr/local/bin/geckodriver /usr/bin/geckodriver

Installation seems to have put everything in /usr/local/bin/geckodriver but selinium seems to be looking for /usr/bin/geckodriver so a symlink seem to have solved it.

@Simont in general, Bokeh just checks your existing system PATH for the executables, so another solution is just to make sure /usr/local/bin is on you PATH.

1 Like

In my case, I got this running from a docker container. The fix was to install the required X11 and gtk3 libraries.

1 Like