AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Error: Message: unknown error: cannot find Chrome binary

Open vanillechai opened this issue 2 years ago • 8 comments

Duplicates

  • [X] I have searched the existing issues

Steps to reproduce 🕹

This happens with any AI settings: As soon as the first browse_website command is executed, Auto-GPT fails with this error.

Branch: master commit-hash: e986af5de0f1bd933f6c936c3674301c80f6c91f

also happens on: Branch: stable commit-hash: 60b2b61b52c263dba25a6c33623561273e890229

Current behavior 😯

  System: Command browse_website returned: Error: Message: unknown error: cannot find Chrome binary
Stacktrace:
0   chromedriver                        0x00000001027bd670 chromedriver + 4298352
1   chromedriver                        0x00000001027b5bbc chromedriver + 4266940
2   chromedriver                        0x00000001023e8758 chromedriver + 280408
3   chromedriver                        0x000000010240de40 chromedriver + 433728
4   chromedriver                        0x000000010240c308 chromedriver + 426760
5   chromedriver                        0x000000010244c994 chromedriver + 690580
6   chromedriver                        0x000000010244c114 chromedriver + 688404
7   chromedriver                        0x00000001024162d0 chromedriver + 467664
8   chromedriver                        0x0000000102417354 chromedriver + 471892
9   chromedriver                        0x000000010277d6c4 chromedriver + 4036292
10  chromedriver                        0x0000000102781c64 chromedriver + 4054116
11  chromedriver                        0x00000001027882d8 chromedriver + 4080344
12  chromedriver                        0x0000000102782970 chromedriver + 4057456
13  chromedriver                        0x00000001027598dc chromedriver + 3889372
14  chromedriver                        0x00000001027a125c chromedriver + 4182620
15  chromedriver                        0x00000001027a13b4 chromedriver + 4182964
16  chromedriver                        0x00000001027b00f4 chromedriver + 4243700
17  libsystem_pthread.dylib             0x0000000188e13fa8 _pthread_start + 148
18  libsystem_pthread.dylib             0x0000000188e0eda0 thread_start + 8

After this, Auto-GPT reasons I will try to find an alternative to Chrome and use the \'google\' command to find other open source software that meets the requirements., re-encounter the error and goes into a loop.

Expected behavior 🤔

  • It used to work until I git pulled this morning.
  • There is no point in installing the Chrome binary, as Auto-GPT is running on a headless machine and I am connected via ssh.

Your prompt 📝

This error is independent of the prompt.

vanillechai avatar Apr 15 '23 09:04 vanillechai

you need to install chrome on the default paths, works for me

AlizerUncaged avatar Apr 15 '23 09:04 AlizerUncaged

you need to install chrome on the default paths, works for me

How can you do that on a headless machine? How would Chrome run from Docker or docker-compose?

vanillechai avatar Apr 15 '23 10:04 vanillechai

#1520 this would add support for headless

mezzovide avatar Apr 15 '23 10:04 mezzovide

FYI, got around this by adding --headless as per above, but also had to add an option for --no-sandbox, making sure the --no-sandbox is the first option, as per https://stackoverflow.com/questions/53073411/selenium-webdriverexceptionchrome-failed-to-start-crashed-as-google-chrome-is

This seemed to do the trick.

ricktonoli avatar Apr 15 '23 12:04 ricktonoli

You can refer to my single docker image dockerfile. It come with redis server and redisearch module.

https://github.com/tuapuikia/Auto-GPT/blob/master/Dockerfile-s6

https://github.com/tuapuikia/Auto-GPT/blob/44739518ee4f9c27cc4596eb14587bdbfd68e842/Dockerfile-s6#L20

RUN apt update && apt -y install vim redis-server chromium-driver chromium && \

tuapuikia avatar Apr 15 '23 14:04 tuapuikia

I had it working using:

selenium.version '4.8.3'

chrome-driver and google-chrome-stable 109

web.py

options.binary_location=r'/usr/bin/google-chrome-stable'
driver = webdriver.Chrome(
    executable_path='/home/gabriel/Auto-GPT/chromedriver', options=options
)

gabrielrbarbosa avatar Apr 15 '23 21:04 gabrielrbarbosa

I managed to fix it by modifying web.py and adding the following under user agent option... Be sure to download chromedriver here:. https://chromedriver.chromium.org/downloads.

    options.add_argument("--headless=new")
    options.add_argument("--no-sandbox")
    options.add_argument("--ignore-ssl-errors=true")
    options.add_argument("--ignore-certificate-errors")    
    
    options.binary_location="C:/Program Files/Google/Chrome Beta/Application/chrome.exe"
    driver = webdriver.Chrome('C:/PATH_TO/chromedriver_win32/chromedriver.exe',options=options)

I still get SSL handshake errors on occasion, not sure which argument needs to be added to ignore those.

xpose2000 avatar Apr 16 '23 16:04 xpose2000

install chromium-chromedriver on a headless machine, note you should have systemd to use snap. For wsl user, try this https://stackoverflow.com/questions/62588767/running-google-chrome-on-wsl-ubuntu-as-headless-no-sandbox-gives-multiple

dasoumao avatar Apr 16 '23 16:04 dasoumao

The following worked for me on Windows 10 in Ubuntu WSL. Edit web_selenium.py here:

options.binary_location="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"

driver = webdriver.Chrome(
    executable_path="/mnt/c/Users/your_user_name/Auto-GPT/chromedriver", options=options
)

  • You can find the path to chrome.exe by right-clicking the Chrome icon on your desktop, select Properties, copy the path to the executable from Target.
  • Download chromedriver.exe and save it to a path as set for executable_path above.

It would be great if the file path to chromedriver.exe and chrome.exe could be configurable in the .env file.

primaryobjects avatar Apr 18 '23 23:04 primaryobjects

I managed to fix it by modifying web.py and adding the following under user agent option... Be sure to download chromedriver here:. https://chromedriver.chromium.org/downloads.

    options.add_argument("--headless=new")
    options.add_argument("--no-sandbox")
    options.add_argument("--ignore-ssl-errors=true")
    options.add_argument("--ignore-certificate-errors")    
    
    options.binary_location="C:/Program Files/Google/Chrome Beta/Application/chrome.exe"
    driver = webdriver.Chrome('C:/PATH_TO/chromedriver_win32/chromedriver.exe',options=options)

I still get SSL handshake errors on occasion, not sure which argument needs to be added to ignore those.

Does it work on Mac? I mean if download chrome driver for ma and reference the path

Stausifr avatar Apr 19 '23 04:04 Stausifr

Please check if this is resolved with #1473. If this issue still exists in master for you, feel free to reopen.

Pwuts avatar Apr 19 '23 22:04 Pwuts