Forums

(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

can You please switch me to new virtualization so that i can run selenium with chrome. pls help

No problem. I have switched your account. The new system will be used in new consoles and by your web app when it is reloaded.

Glenn,

The same thing is happening to me

Traceback is below

`

Traceback (most recent call last):
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
Traceback (most recent call last):
  File "/home/mattwelter/insta/users/nycforest/lcf.py", line 229, in <module>
    driver = webdriver.Chrome(options=opts)
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
Traceback (most recent call last):
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
Traceback (most recent call last):
  File "/home/mattwelter/insta/users/nycforest/lcf.py", line 229, in <module>
    driver = webdriver.Chrome(options=opts)
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
Traceback (most recent call last):
  File "/home/mattwelter/insta/users/nycforest/lcf.py", line 230, in <module>
    driver = webdriver.Chrome(options=opts)
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/mattwelter/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/mattwelter/.local/lib/python3.8/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/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

`

Make sure you're using the correct options and selenium - like in this post: https://www.pythonanywhere.com/forums/topic/27202/#id_post_78144

Also, there seems to be some sort of thing where you're starting multiple subprocesses and multiple webdrivers. First try doing it directly and with only one, before you try doing it multiple times through subprocesses.

Okay I made sure I'm using the correct options and Selenium version like the post you sent, but I'm not sure where I'm starting multiple subprocesses. I searched through the script and I'm only calling only one webdriver. Maybe I'm looking for the wrong thing? Thoughts?

Got my answer, found out I wasn't running headless. All I had to do was uncomment opts.add_argument('--headless')

Good to see that you sorted it out!

hello ! i got the same error. could you please switch my account too. Thanks

No problem I have enabled it for your account.

Thank you for your quick and kind reply.

Can you enable the same for my account as well. I am facing the same error.

No problem, I've switched on the new virtualization system for your account. Any new consoles you start will have the new features; any scheduled/always-on tasks and websites will pick it up the next time they're (re)started.

To use Chrome, you'll also 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("--no-sandbox")
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()

[edit 2022-08-27: added missing --no-sandbox option]

Thank you for your prompt response!!

Hi, can you please switch me to new virtualization so that i can run selenium with chrome. thank a lot in advance

Sure, no problem -- that's done now.

(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64) please help me in this

Hi @hiralnandaniya. 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.

@hiralnandaniya It's done for you. You should be able to use Chrome now.

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

I see that you've posted about this in another forum thread so I've answered there.

hello i have same problem.

Have you followed the advice posted by @giles above?

hello ! i got the same error. could you please switch my account too. Thanks

All accounts already have it enabled by default now.

hello i have a same problem

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/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Are you using the command-line chrome options from this help page?

(BTW, the post above did not have all of those options at the time that you posted your original message, so if you were using that as your starting point, that would explain the problem.)

Hi, I'm facing the same issue. Can you please switch my account too?

I tired all which mentioned above but the problem not sorted out

All accounts now have access to the new virtualization system, so yours doesn't need updating. What happens if you run the sample code above?

Hi, i got a same issue. Can you please switch my account too?

All accounts now have access to the new virtualization system, so yours doesn't need updating. What happens if you run the sample code above?

Hi,

I have the same issue,

Here are my imports :

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
import pandas as pd

and my options :

chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=chrome_options)

and when I run the sample code, it returns this :

  Input In [9]
    return "Page title was '{}'".format(browser.title)
    ^
SyntaxError: 'return' outside function

Can you please help ?

Thanks !!

@richdotcom Example above assumed that it's inside a function, that's why return was there (example is fixed now). What if you configure your chrome_options like in the example here?

it says this :

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/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x5609f2455e89 <unknown>

Did you start multiple instances of Chrome? Are you using the default selenium and chromedriver for your system image? Which Python version are you using?

Did you start multiple instances of Chrome?

How would I know if I started multiple instances of chrome ? I restart the kernel everytime however.

Are you using the default selenium and chromedriver for your system image?

I'm using ChromeDriverManager

Which Python version are you using?

Python 3.10

What if you use pre-installed chromediriver like in the example?

It says this

/tmp/ipykernel_2820/3745922108.py:4: DeprecationWarning: executable_path has been deprecated, please pass in a Service object

driver = webdriver.Chrome(r'/home/richdotcom/chromedriver.exe',options=chrome_options)

Do you have the ability to access my code and see what's wrong in there ? I can't really send it here...

Thanks

/home/richdotcom/chromedriver.exe is not our pre-installed driver. Also it does not look like Linux executable. try that first.

I've already done that, it says :

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 is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55745888ae89 <unknown>

Did you run exactly the code from the example? If not, what was the modification?

omg man, why would I change anything?? You told me to run the code I ran the exact same code

THIS

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
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()

Would you please reply faster ? This has been going on for 4 days now, I'm basically paying for nothing

Thanks

Sorry to hear that! So far we can't reproduce the behavior you're describing and we're trying to find the difference between the default setup and your setup. I understand that you run exactly the same snippet as we provide on our help page in a Jupyter Notebook for Python 3.10. You restart the kernel every time before running the snippet and you don't run any other snippets before the exemplary one. Is that correct? Also, could you run this in you notebook: import selenium; print(selenium.__version__, selenium.__file__)?

Same error when adding import selenium; print(selenium.__version__, selenium.__file__)

Also yes, I always restart the kernel and clear outputs before running again

Sorry, I wasn't clear enough -- could you share the output of print(selenium.__version__, selenium.__file__)? It's not a fix, just trying to gather more data.

oh okay my bad

from selenium import webdriver
print(selenium.__version__, selenium.__file__)

returns

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [2], in <cell line: 2>()
      1 from selenium import webdriver
----> 2 print(selenium.__version__, selenium.__file__)

NameError: name 'selenium' is not defined

You need to import selenium first. Please run this

import selenium; print(selenium.__version__, selenium.__file__)

in a separate cell and show the output.

that's the output

4.1.5 /usr/local/lib/python3.10/site-packages/selenium/__init__.py

OK, that's as we would expect. Could you try creating a completely fresh notebook from the Dashboard, and then just run a single cell with the basic sample code:

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
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()

(The same as above, just reposting for convenience)

...and let us know if it prints out the same error? A screenshot might be useful, just to make sure that we're not missing something important. For example, I got this result.

Oh that worked, but only once...

It said the same as in your screenshot, but as soon as I ran my initial code with the same chrom_options, it broke again, and now even the google page title doesn't work

That suggests that you did not close the browser correctly in your initial code (the try except stuff in the example), so it was left running and interfered with subsequent calls. You need to make sure that you clear down the browser all the time - including when there are errors.

My selenium stopped working on 02/01/2023, I upgraded my selenium version and added chrome_options.add_argument('--disable-dev-shm-usage') Worked on first try but now I'm getting this error:

(chrome not reachable)                                                                                                                                         
(The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Where are you running your selenium code on PythonAnywhere? To which version did you upgrade?

On console and tasks, now I'm getting this error:

selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
Stacktrace:
#0 0x56040c166e89 <unknown>

Current system image:haggis and Selenium version 4.7.2 according this post https://help.pythonanywhere.com/pages/selenium/

You have a number of chrome processes still running. You can see them on your Consoles page by clicking the "Fetch process list" button. When you have too many processes and threads running (chrome starts a large number of threads), then you cannot start new chrome processes.

Killed all the running processes and looks fine right now, thx in advance.

Glad to hear that -- thanks for confirming that!

.

Traceback (most recent call last):
  File "/home/Vladislav1989/bot1/My_projekt_mzda.py", line 449, in <module>
    bot.polling(none_stop=True, interval=0)
  File "/home/Vladislav1989/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1043, in polling
    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
  File "/home/Vladislav1989/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1118, in __threaded_polling
    raise e
  File "/home/Vladislav1989/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1074, in threaded_polling
    self.worker_pool.raise_exceptions()
  File "/home/Vladislav1989/.local/lib/python3.10/site-packages/telebot/util.py", line 147, in raise_exceptions
    raise self.exception_info
  File "/home/Vladislav1989/.local/lib/python3.10/site-packages/telebot/util.py", line 90, in run
    task(*args, **kwargs)
  File "/home/Vladislav1989/.local/lib/python3.10/site-packages/telebot/__init.py", line 6770, in _run_middlewares_and_handler
    result = handler['function'](message)
  File "/home/Vladislav1989/bot1/My_projekt_mzda.py", line 237, in callback
    Final_func.result(call)
  File "/home/Vladislav1989/bot1/Final_func.py", line 159, in result
    fr_result_1.insert(1, ((config.parsing(str(fr_result[1])))) + int(fr_food_stamps[1]))
  File "/home/Vladislav1989/bot1/config.py", line 128, in parsing
    driver = webdriver.Chrome(options=option)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in init
    super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in init
    RemoteWebDriver.init(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 275, in init
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 365, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 430, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, 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/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x56528eabce89 <unknown>

help me please. I tried installing different Chrome drivers, but it still doesn't work.

Could you run the gist from this help page and check if that works on your account?

Hello, i have the same issue:

Here's the problem:

Traceback (most recent call last):
  File "/home/Nani/wallapopBot.py", line 8, in <module>
    nuevosProductos = buscar_nuevos_productos()
  File "/home/Nani/./buscaProductos.py", line 7, in buscar_nuevos_productos
    driver = iniciar_chrome()
  File "/home/Nani/./librerias.py", line 26, in iniciar_chrome
    return webdriver.Chrome(options=options)
  File "/home/Nani/.local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/home/Nani/.local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "/home/Nani/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 269, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/Nani/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 360, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/Nani/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute
    self.error_handler.check_response(response)
  File "/home/Nani/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, 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/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55c7f8c44e89 <unknown>

I did this https://help.pythonanywhere.com/pages/selenium/ but nothing change

If you're following the help page and you still get this error, check if you're not starting multiple browsers at a time or/and you're not in a tarpit, as well.