tomahim / py-image-dataset-generator

Get a large image dataset with minimal effort by grabbing image through the web and generate new ones by image augmentation.
MIT License
218 stars 41 forks source link

cannot find chrome binary #3

Closed marcoaleixo closed 6 years ago

marcoaleixo commented 6 years ago

When I run : python dataset_generator.py "red car" -limit 50 -dest images -size large

I receive a bunch of errors:

searching image on Google : https://www.google.co.in/search?q=red+car&source=lnms&tbm=isch Traceback (most recent call last): File "dataset_generator.py", line 65, in downloader.download_images(keyword) File "/home/marco/projetos/deepfaces/faceswap/py-image-dataset-generator/image_grabber/image_downloader.py", line 43, in download_images images.extend(google_grabber.get_images_url(self.keyword)) File "/home/marco/projetos/deepfaces/faceswap/py-image-dataset-generator/image_grabber/google_grabber.py", line 30, in get_images_url browser = webdriver.Chrome(chrome_options=options) File "/home/marco/miniconda2/envs/deepfaces/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in init desired_capabilities=desired_capabilities) File "/home/marco/miniconda2/envs/deepfaces/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in init self.start_session(desired_capabilities, browser_profile) File "/home/marco/miniconda2/envs/deepfaces/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/marco/miniconda2/envs/deepfaces/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute self.error_handler.check_response(response) File "/home/marco/miniconda2/envs/deepfaces/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.13.0-32-generic x86_64)

I did pip install -r req...txt on my condaenv with python 3.5

tomahim commented 6 years ago

Hi,

Did you try to add chrome.exe manually in your PATH? It seems that it can fail to find the Chrome binary, if Chrome is not installed at the default location.

tomahim commented 6 years ago

I just saw you are on Linux, this post may help you : https://stackoverflow.com/questions/8255929/running-selenium-webdriver-python-bindings-in-chrome/24364290#24364290

Your chromedriver may not be in your /usr/bin folder.

For now, I had only test my script on Windows. I plan to do more test on other plateforms.

Let me know if it resolves your issue !

marcoaleixo commented 6 years ago

I will try and if I found the solution I post here.

maxpastor commented 6 years ago

Okay, so the right way to do it is to download the chromedriver.zip from source and unzip it in /usr/local/bin. sudo unzip ./chromedriver_linux64.zip chromedriver -d /usr/local/bin/ You can download the drivers from this site

tomahim commented 6 years ago

Thank you @maxpastor, I think an alternative way would be to run this command

pip install chromedriver_installer --install-option="--chromedriver-version=2.35"

According to this documentation, chromedriver should be available in your PATH, so selenium is able to find it.

tomahim commented 6 years ago

@marcoaleixo I was able to reproduce your issue on Linux and using python 3.5.

To make this working I needed to install the chromium-browser package (sudo apt-get install chromium-browser).

Running the command python3 -m pip install -r requirements.txt or pip install chromedriver_installer --install-option="--chromedriver-version=2.35" worked well for me as it's installed somewhere in the PATH. You can check the folder location with this command which chromedriver and make sur it's in your $PATH variable.

I updated the README section.