Chromedriver won't run on WSL (Windows + Ubuntu subsystem) #89
Closed
by wrapper opened 6 years ago
·
11 comments
Loading…
Reference in new issue
There is no content yet.
Delete Branch '%!s(MISSING)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
I get the following error message:
Message: unknown error: Chrome failed to start: crashed (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Not sure if anyone's got a way around this? I understand you can run Chrome headless on WSL using these flags:
google-chrome --no-sandbox --disable-gpu --disable-features=VizDisplayCompositor --headless --dump-dom
However you can't pass those flags through the deletefb script so I'm a bit stuck. Currently running it in a VM instead
You can run it in headless mode with
--headless
, and it will dogoogle-chrome --disable-gpu --headless
, see here8896549318/deletefb/tools/login.py (L33-L34)
That may or may not work for you. There's also the option of running the docker container (which hasn't really been tested much to be honest, and will wipe out your archive files when it exits).
If those other flags are actually necessary to run it headless on WSL, then I can add them, but if you just want to try it out, then modify the lines I linked above and add the extra flags, then install it from source (i.e. option 2 here https://github.com/weskerfoot/DeleteFB#installation)
If the extra flags are necessary then they can be added so they get passed when the
--headless
option is passed to deletefb.Thanks for getting back. It threw the same error with --headless so I tried adding the flags, but when I try to run the script using
pip3 install --user
I just get "You must give at least one requirement to install (see "pip help install")"I tried 'python -m deletefb.deletefb' but that doesn't find selenium
@wrapper I think you forgot the directory at the end of the command
pip3 install --user .
. It assumes you're running it in the cloned git repo (as incd DeleteFB; pip3 install --user .
)Thanks, not sure if I'm being stupid but I added the following arguments:
if is_headless: chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-features=VizDisplayCompositor') chrome_options.add_argument('--dump-dom') chrome_options.add_argument('log-level=2')
And now it throws this when I add the --headless parameter:
Traceback (most recent call last): File "/home/user/.local/bin/deletefb", line 11, in <module> load_entry_point('delete-facebook-posts==1.1.9', 'console_scripts', 'deletefb')() File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point return ep.load() File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load return self.resolve() File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/home/user/.local/lib/python3.6/site-packages/deletefb/deletefb.py", line 5, in <module> from .tools.login import login File "/home/user/.local/lib/python3.6/site-packages/deletefb/tools/login.py", line 35 chrome_options.add_argument('--no-sandbox') ^ TabError: inconsistent use of tabs and spaces in indentation
@wrapper you can't mix tabs and spaces in Python. I'll put together a quick commit that adds these options so you can try it out
@wrapper If you want you can go to https://github.com/weskerfoot/DeleteFB/tree/headless-fix and then clone or download and try the same process as before.
Closing since I merged the changes to the chrome flags
Sorry to pester. I seem to have messed up the uninstall / reinstall and now I get this error trying to run with the new code:
Traceback (most recent call last): File "/home/user/.local/bin/deletefb", line 11, in <module> load_entry_point('delete-facebook-posts==1.1.9', 'console_scripts', 'deletefb')() File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point return ep.load() File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load return self.resolve() File "/home/user/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) ModuleNotFoundError: No module named 'deletefb'
@wrapper What was the command you used to run it?
Also I've merged those changes so if you follow these steps (starting with a clean directory)
git clone https://github.com/weskerfoot/DeleteFB.git
cd DeleteFB
pip3 install --user .
deletefb --headless -E 'youremail@example.org' -P 'yourfacebookpassword' -U 'https://www.facebook.com/your.profile.url'
It should work. Let me know if it does not.
Thanks for your efforts. Following the steps above, I still get an error to do with chrome driver:
Traceback (most recent call last): File "/home/user/.local/bin/deletefb", line 11, in <module> load_entry_point('delete-facebook-posts==1.1.9', 'console_scripts', 'deletefb')() File "/home/user/.local/lib/python3.6/site-packages/deletefb/deletefb.py", line 105, in run_delete two_factor_token=args.two_factor_token File "/home/user/.local/lib/python3.6/site-packages/deletefb/tools/login.py", line 41, in login driver = setup_selenium(driver_path, chrome_options) File "/home/user/.local/lib/python3.6/site-packages/deletefb/tools/chrome_driver.py", line 52, in setup_selenium return webdriver.Chrome(executable_path=driver_path, options=options) File "/home/user/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__ desired_capabilities=desired_capabilities) File "/home/user/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/home/user/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/user/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/user/.local/lib/python3.6/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: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)