I need to run a headless chrome browser with selenium, which isn't possible on the current system.
Could you please switch my account to the new virtualization system, referred to in this thread.
Thank you!
I need to run a headless chrome browser with selenium, which isn't possible on the current system.
Could you please switch my account to the new virtualization system, referred to in this thread.
Thank you!
OK, that's done.
Thank you very much!
I'm sorry to come back to this thread, but I still can't start a chrome browser.
I've been following this thread using the following code:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
Running this still crashes the script (Python 3.7) with the following errors:
Traceback (most recent call last):
File "/home/Jonisch/.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/Jonisch/screen_test.py", line 10, in <module>
browser = webdriver.Chrome(options=chrome_options)
File "/home/Jonisch/.local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/Jonisch/.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.com/a/chromium.org/chromedrive
r/home
Any idea, why this is happening?
Thank you for your help!
So chrome driver should be at /usr/local/bin/chromedriver
. First check if you can see that (eg: by doing a ls
from a bash console). Then check what is in your PATH (eg: by doing a echo $PATH
from a bash console), and see if /usr/local/bin/
is in PATH.
Have you been changing around your bashrc etc?
I checked /usr/local/bin an
and chromedriver isn't there. I haven't changed anything except files I have created or uploaded.
/usr/local/bin/
is in PATH.
Do I, perhaps, have to be a paying user for this to work?
Thanks again!
Looks like we should switch you from earlgray system image to the new fishnchips one.
One word of warning first -- because changing the system image upgrades a lot of the pre-installed Python packages, any code that you have that relies on those packages might break if it's not compatible with the new versions. Also, because the new image has newer versions of Python, if you have any virtualenvs, you may need to rebuild them. If you're happy to go ahead despite that, just let us know and we'll switch you over.
Sounds good!
I'm ready to change to the new system image, please switch me over.
OK, It's done
Could you please switch my account to the new virtualization system, referred to in this thread
Thank you!
No problem. That's done. However, your account is also on a really old system image, so chrome headless is not available. We can update your system image, but note that switching to the new version may break some of your existing code that worked on older versions. You may need to recreate any virtualenvs that you're using and you will need to start new consoles and reload your web apps.
Hi Glenn! Thanks. Please update my system image. Happy to recreate/update anything that doesn't work/start new consoles. I appreciate your quick reply and assistance. Have a great day.
No problem. That's done.
Thank you!
I want to use chromedriver. Could you please switch my account to the new virtualization system, referred above.
Thank you!
No problem. I have updated your system image.
Hello. I also want to use chromedriver. Could you please switch my account to the new virtualisation system, referred above.
Sure, that's done now.
Wow! Thanks a lot.
HI, I also would like to use chromediver. Can you please switch my account to the new virtualisation system too?
Can my account be switched to the new virtualisation system please, I would really like to use chromedriver.
No problem, that's done now.
thank you
No problem!
Is this still something that is done? And if so, can my account please be switched?
Hi @jlabrie. We're currently in the process of enabling the new virtualization system for all accounts on PythonAnywhere, which unfortunately may take a week or two to complete. We'll let you know when that has been done for your account; I've made a note to make sure that you're in one of the first batches to be moved over to it.
Thank you very much!
No problem.
@jlabrie It's done for you
Thank you!!
Glad we could help :-)
Message: unknown error: Chrome failed to start: exited abnormally (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.)
please suggest what to do?
WebDriverException at / Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
We're currently in the process of enabling the new virtualization system for all accounts on PythonAnywhere, which unfortunately may take a week or two to complete. We'll let you know when that has been done for your account; I've made a note to make sure that you're in one of the first batches to be moved over to it, and we'll let you know here in the forums when it's done.
OK Thank You Giles, waiting for it to be enabled, please let me know once enabled. !
Hi @Ghaithalasadi -- we've enabled virtualization feature for you. Here are the next steps:
To use Chrome, you'll need to upgrade Selenium for your account -- for example, if you're using Python 3.7, run this in Bash:
pip3.7 install --user --upgrade selenium
...and then you can run Selenium with Chrome using code like this:
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()
@pafk It's working Now ! Thank You So much.
Thanks for confirming that :)
Hi there, I'd be grateful if you could switch me over to the experimental virtualization system too :) Thanks!
It's no longer experimental :-) All accounts now use it, so you have it already.
Ah I will follow the above steps thank you :)