Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
Other
167.94k stars 44.33k forks source link

Error: Message: unknown error: cannot find Chrome binary #1517

Closed vanillechai closed 1 year ago

vanillechai commented 1 year ago

Duplicates

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 🤔

Your prompt 📝

This error is independent of the prompt.

AlizerUncaged commented 1 year ago

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

vanillechai commented 1 year ago

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?

mezzovide commented 1 year ago

1520 this would add support for headless

ricktonoli commented 1 year ago

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.

tuapuikia commented 1 year ago

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 && \
gabrielrbarbosa commented 1 year ago

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
)
xpose2000 commented 1 year ago

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.

dasoumao commented 1 year ago

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

primaryobjects commented 1 year ago

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
)

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

Stausifr commented 1 year ago

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

Pwuts commented 1 year ago

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