Forums

'chromedriver' executable needs to be in PATH

Hi,

I believe headless chrome was enabled on my account. I've upgraded selenium and am running this simple test script:

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

However, I get the following error:

Traceback (most recent call last):
  File "/home/manwithfewneeds/.local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
  File "/usr/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/manwithfewneeds/.local/lib/python3.7/test_selenium.py", line 6, in <module>
    browser = webdriver.Chrome(options=chrome_options)
  File "/home/manwithfewneeds/.local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", 
line 73, in __init__
    self.service.start()
  File "/home/manwithfewneeds/.local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", 
line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. 
Please see https://sites.google.co
m/a/chromium.org/chromedriver/home

It doesn't appear that chromedriver is in my PATH (at least I can't find it in the file system). Any help please?

It looks like we may need to upgrade your system image to one that provides Chromedriver -- that will basically upgrade the version of the operating system your account uses. All of your files and data will be kept safe, but the versions of Python installed and the pre-installed packages will be upgraded.

One word of warning, though -- because of the changes to the point releases of Python (eg. 3.7.0 to 3.7.5), any virtualenvs you have might break -- and if you're not using virtualenvs, the pre-installed Python modules will be upgraded so that might break any code you have that relies on the old installed versions.

If you're happy for us to switch you over despite that, then let us know.

Hi there. I seem to be having the same issue. I've attempted to install chromedriver in the site packages, but am still receiving the same error as above. The code runs fine on my PC.

Traceback (most recent call last): File "/home/michaelturner008/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "/usr/lib/python3.8/subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'lib/chromedriver' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/michaelturner008/.virtualenvs/through-the-marshes/bid-fta-scrape.py", line 293, in <module> main() File "/home/michaelturner008/.virtualenvs/through-the-marshes/bid-fta-scrape.py", line 22, in main browser = set_up_browser() File "/home/michaelturner008/.virtualenvs/through-the-marshes/bid-fta-scrape.py", line 288, in set_up_browser browser = webdriver.Chrome('lib/chromedriver', options=options, desired_capabilities=caps) File "/home/michaelturner008/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in init self.service.start() File "/home/michaelturner008/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

@michaelturner008 It looks like you are already in contact with us over support email.

apologies! I hadn't seen the email - I'll continue the conversation there.

Hi @giles. Can you please also update me to use chromedriver? I understand this changes the image, and approve of you to change it. Thank you!

@LeonardPetracci You no longer need to ask to have your system image changed -- you can change it yourself from the "Account" page. There's more information on this help page: https://help.pythonanywhere.com/pages/ChangingSystemImage

HI! I have same error message below. Would you help me upgrading my system image to one that provides Chromedriver? Thank you!


selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Your system image has chromedriver. What is in your PATH?

Hi , tried changing that system image but it looks like i have the most recent one. Is there any other way to fix this error? Any help would be appreciated <3

What do you see if you look at your system path -- that is,

echo $PATH

...in a Bash console?

that's what I got from typing the above in my bash console : /home/my_username/.local/bin:/usr/local/julia-1.6.1/bin:/home/my_username/.local/bin:/usr/local/julia-1.6.1/bin:/usr/local/sbin:/usr/local/bin:/usr/ sbin:/usr/bin:/sbin:/bin

That looks like it should be working, so my guess is that you are specifying the path to chromedriver in your code and pointing to a place where is isn't. What happens when you use the example code at the top of this topic in a new console?

the example code used above seem to be working completly fine when I run it on my bash console .

Great! Then you can use the example to modify the code you want to run so that it follows the same pattern.

That's what I did . Thank you for taking the time to respond and trying to help me , I appreciate that <3 I just have never worked with linux neither have I worked with pythonanywhere before , All i did was pasting the script i had written on vscode here on pythonanywhere and pressed run , after that error i decided to download a webdriver that is used for linux and then getting it's path but that didn't work either . Anyways.Thank you.

Glad to hear that you are progressing.