InstaPy no longer executing after last pull

Created on 4 Jul 2018  Â·  42Comments  Â·  Source: timgrossmann/InstaPy

Just updateded to the latest merge via git pull and now nothing works anymore unfortunately

Expected Behavior

programm should run

Current Behavior

after entering:

sudo python3 quickstart.py
my password is required, like always, I enter it and then, nothing happens and after a minute this appears:

ERROR [2018-07-04 19:17:05] [myuser] Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 4.15.0-24-generic x86_64)
Traceback (most recent call last):
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 4.15.0-24-generic x86_64)

Traceback (most recent call last):
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 4.15.0-24-generic x86_64)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "quickstart.py", line 21, in
multi_logs=True)
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 190, in __init__
self.set_selenium_local_session()
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 301, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/n-rg/venv/bin/InstaPy/assets/chromedriver

Most helpful comment

So sorry but I think I copy and paste half of the function code
Please try this one complete function code again

def set_selenium_local_session(self):
    """Starts local session for a selenium server.
    Default case scenario."""
    if self.aborting:
        return self

    if self.use_firefox:
        if self.browser_profile_path is not None:
            firefox_profile = webdriver.FirefoxProfile(
                self.browser_profile_path)
        else:
            firefox_profile = webdriver.FirefoxProfile()

        # permissions.default.image = 2: Disable images load,
        # this setting can improve pageload & save bandwidth
        firefox_profile.set_preference('permissions.default.image', 2)

        if self.proxy_address and int(self.proxy_port) > 0:
            firefox_profile.set_preference('network.proxy.type', 1)
            firefox_profile.set_preference('network.proxy.http',
                                           self.proxy_address)
            firefox_profile.set_preference('network.proxy.http_port',
                                           self.proxy_port)
            firefox_profile.set_preference('network.proxy.ssl',
                                           self.proxy_address)
            firefox_profile.set_preference('network.proxy.ssl_port',
                                           self.proxy_port)

        self.browser = webdriver.Firefox(firefox_profile=firefox_profile)

    else:
        chromedriver_location = Settings.chromedriver_location
        chrome_options = Options()
        #chrome_options.add_argument("--disable-infobars")
        chrome_options.add_argument("--mute-audio")
        chrome_options.add_argument('--dns-prefetch-disable')
        #chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--lang=en-US')
        chrome_options.add_argument('--disable-setuid-sandbox')

        # this option implements Chrome Headless, a new (late 2017)
        # GUI-less browser. chromedriver 2.9 and above required
        if self.headless_browser:
            chrome_options.add_argument('--headless')
            # Replaces browser User Agent from "HeadlessChrome".
            user_agent = "Chrome"
            chrome_options.add_argument('user-agent={user_agent}'
                                        .format(user_agent=user_agent))
        capabilities = DesiredCapabilities.CHROME
        # Proxy for chrome
        if self.proxy_address and int(self.proxy_port) > 0:
            prox = Proxy()
            proxy = ":".join([self.proxy_address, self.proxy_port])
            prox.proxy_type = ProxyType.MANUAL
            prox.http_proxy = proxy
            prox.socks_proxy = proxy
            prox.ssl_proxy = proxy
            prox.add_to_capabilities(capabilities)

        # add proxy extension
        if self.proxy_chrome_extension and not self.headless_browser:
            chrome_options.add_extension(self.proxy_chrome_extension)

        if self.browser_profile_path is not None:
            chrome_options.add_argument('user-data-dir={}'.format(self.browser_profile_path))

        chrome_prefs = {
            'intl.accept_languages': 'en-US'
        }
        chrome_options.add_experimental_option('prefs', chrome_prefs)


        chrome_options.add_argument('--headless')
        chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--disable-dev-shm-usage')

        try:

            self.browser = webdriver.Chrome(chromedriver_location,chrome_options=chrome_options)

            # self.browser = webdriver.Chrome(chromedriver_location,
            #                                 desired_capabilities=capabilities,
            #                                 chrome_options=chrome_options)
        except selenium.common.exceptions.WebDriverException as exc:
            self.logger.exception(exc)
            raise InstaPyError('ensure chromedriver is installed at {}'.format(
                Settings.chromedriver_location))

        # prevent: Message: unknown error: call function result missing 'value'
        matches = re.match(r'^(\d+\.\d+)',
                           self.browser.capabilities['chrome']['chromedriverVersion'])
        if float(matches.groups()[0]) < Settings.chromedriver_min_version:
            raise InstaPyError('chromedriver {} is not supported, expects {}+'.format(
                float(matches.groups()[0]), Settings.chromedriver_min_version))

    self.browser.implicitly_wait(self.page_delay)

    message = "Session started!"
    highlight_print(self.username, message, "initialization", "info", self.logger)
    print('')

    return self

All 42 comments

Experiencing the exact same error. I think that it has something to do with the versioning of chromiun and chromedriver...

Maybe this information ist useful so someone:
My output of apt-cache policy chromedriver is
Installed: 67.0.3396.87-1~deb9u1
Candidate: 67.0.3396.87-1~deb9u1

My output of apt-cache policy chromium is
Installed: 67.0.3396.87-1~deb9u1
Candidate: 67.0.3396.87-1~deb9u1

My output of apt-cache policy chromium-browser is
Installed: 65.0.3325.181-0+rpt4
Candidate: 65.0.3325.181-0+rpt4

And I think this is a problem, because of the mixed up versions (v65 and v67). Also I am only able to install chromedriver 2.37 on my raspberry pi 3.

@realsony How did you manage to install v2.38? Seems you are also using a raspberry pi.
I think that the versions of the packages are a problem because chromedriver v2.37 supports Chrome v64-66 and chromedriver v2.38 supports Chrome v65-67 according to the chromedriver's downloadpage

I also tried with version 2.40

I use ubuntu.

please uncomment:

chrome_options.add_argument('--no-sandbox')

in your instapy.py

ERROR [2018-07-04 22:07:53] [myname]  Message: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)
Traceback (most recent call last):
  File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
    chrome_options=chrome_options)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)

Traceback (most recent call last):
  File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
    chrome_options=chrome_options)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "quickstart.py", line 21, in <module>
    multi_logs=True)
  File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 190, in __init__
    self.set_selenium_local_session()
  File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 301, in set_selenium_local_session
    Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/n-rg/venv/bin/InstaPy/assets/chromedriver

@realsony did you follow the step i mentioned above ?
Is the chrome driver available in desired folder ? Is chromdriver with chmod 777 ??

Yes I did. And as I wrote, before the last pull request it worked fine for months. Driver is also in the folder.

please uncomment:

chrome_options.add_argument('--no-sandbox')

in your instapy.py

Il giorno mer 4 lug 2018 alle 22:24 AnnaKl notifications@github.com ha
scritto:

Yes I did. And as I wrote, before the last pull request it worked fine for
months. Driver is also in the folder.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/timgrossmann/InstaPy/issues/2372#issuecomment-402554186,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLBaDdGy-ruX97_3qHnGuJz_Xf9eEEQks5uDSSIgaJpZM4VC3xB
.

>

  • MetU.*

Wait sorry, i should uncomment it? It was already uncommented when I startetd this issue. If I comment it out I get the error like https://github.com/timgrossmann/InstaPy/issues/2372#issuecomment-402552297

Uncomment

Il giorno mer 4 lug 2018 alle 22:30 AnnaKl notifications@github.com ha
scritto:

Wait sorry, i should uncomment it? It was already uncommented. If I
comment it out I get the error like #2372 (comment)
https://github.com/timgrossmann/InstaPy/issues/2372#issuecomment-402552297

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/timgrossmann/InstaPy/issues/2372#issuecomment-402554859,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLBaHkPgq2WHwB1wE2JZG0EDG9bB0-bks5uDSXegaJpZM4VC3xB
.

>

  • MetU.*

if self.headless_browser:
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
# Replaces browser User Agent from "HeadlessChrome".
user_agent = "Chrome"

ERROR [2018-07-04 22:35:06] [myname] Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)
Traceback (most recent call last):
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)

Traceback (most recent call last):
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "quickstart.py", line 21, in
multi_logs=True)
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 190, in __init__
self.set_selenium_local_session()
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 301, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/n-rg/venv/bin/InstaPy/assets/chromedriver

Same issue with the last PR .... Working fine before that ....

I had the same issue. Not sure if the issue is with Chromedriver versioning or Selenium. But I reset my repository to ~3 commits and it worked fine. The latest PRs might have changed something and broken the program for some people.

I fix the issue with adding these lines of code in the instapy.py, currently there is some bug on the selenium chrome driver which cause this issues.

Hope this helps!

Go to instapy.py and find the function below:

def set_selenium_local_session(self):

Comment out the current self.browser and add codes below:

chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')

try:

    self.browser = webdriver.Chrome(chromedriver_location,chrome_options=chrome_options)

    # self.browser = webdriver.Chrome(chromedriver_location,
    #                                 desired_capabilities=capabilities,
    #                                 chrome_options=chrome_options)

Like this?

if self.headless_browser:
            chrome_options.add_argument('--headless')
            chrome_options.add_argument('--no-sandbox')
            chrome_options.add_argument('--disable-dev-shm-usage')
            # Replaces browser User Agent from "HeadlessChrome".
            user_agent = "Chrome"
            chrome_options.add_argument('user-agent={user_agent}'
                                        .format(user_agent=user_agent))
        capabilities = DesiredCapabilities.CHROME
        # Proxy for chrome
        if self.proxy_address and self.proxy_port > 0:
            prox = Proxy()
            proxy = ":".join([self.proxy_address, self.proxy_port])
            prox.proxy_type = ProxyType.MANUAL
            prox.http_proxy = proxy
            prox.socks_proxy = proxy
            prox.ssl_proxy = proxy
            prox.add_to_capabilities(capabilities)

        # add proxy extension
        if self.proxy_chrome_extension and not self.headless_browser:
            chrome_options.add_extension(self.proxy_chrome_extension)

        if self.browser_profile_path is not None:
            chrome_options.add_argument('user-data-dir={}'.format(self.browser_profile_path))

        chrome_prefs = {
            'intl.accept_languages': 'en-US'
        }
        chrome_options.add_experimental_option('prefs', chrome_prefs)
        try:
            self.browser = webdriver.Chrome(chromedriver_location, chrome_options=chrome_options)
        except selenium.common.exceptions.WebDriverException as exc:
            self.logger.exception(exc)
            raise InstaPyError('ensure chromedriver is installed at {}'.format(
                Settings.chromedriver_location))

Doesn't work for me

mine is like this:

def set_selenium_local_session(self):
    """Starts local session for a selenium server.
    Default case scenario."""
    if self.aborting:
        return self

    if self.use_firefox:
        if self.browser_profile_path is not None:
            firefox_profile = webdriver.FirefoxProfile(
                self.browser_profile_path)
        else:
            firefox_profile = webdriver.FirefoxProfile()

        # permissions.default.image = 2: Disable images load,
        # this setting can improve pageload & save bandwidth
        firefox_profile.set_preference('permissions.default.image', 2)

        if self.proxy_address and int(self.proxy_port) > 0:
            firefox_profile.set_preference('network.proxy.type', 1)
            firefox_profile.set_preference('network.proxy.http',
                                           self.proxy_address)
            firefox_profile.set_preference('network.proxy.http_port',
                                           self.proxy_port)
            firefox_profile.set_preference('network.proxy.ssl',
                                           self.proxy_address)
            firefox_profile.set_preference('network.proxy.ssl_port',
                                           self.proxy_port)

        self.browser = webdriver.Firefox(firefox_profile=firefox_profile)

    else:
        chromedriver_location = Settings.chromedriver_location
        chrome_options = Options()
        #chrome_options.add_argument("--disable-infobars")
        chrome_options.add_argument("--mute-audio")
        chrome_options.add_argument('--dns-prefetch-disable')
        #chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--lang=en-US')
        chrome_options.add_argument('--disable-setuid-sandbox')

        # this option implements Chrome Headless, a new (late 2017)
        # GUI-less browser. chromedriver 2.9 and above required
        if self.headless_browser:
            chrome_options.add_argument('--headless')
            # Replaces browser User Agent from "HeadlessChrome".
            user_agent = "Chrome"
            chrome_options.add_argument('user-agent={user_agent}'
                                        .format(user_agent=user_agent))
        capabilities = DesiredCapabilities.CHROME
        # Proxy for chrome
        if self.proxy_address and int(self.proxy_port) > 0:
            prox = Proxy()
            proxy = ":".join([self.proxy_address, self.proxy_port])
            prox.proxy_type = ProxyType.MANUAL
            prox.http_proxy = proxy
            prox.socks_proxy = proxy
            prox.ssl_proxy = proxy
            prox.add_to_capabilities(capabilities)

copy paste your code snip but got this:

ERROR [2018-07-05 08:59:56] [myname] Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)
Traceback (most recent call last):
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 296, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)

Traceback (most recent call last):
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 296, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-24-generic x86_64)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "quickstart.py", line 21, in
multi_logs=True)
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 189, in __init__
self.set_selenium_local_session()
File "/home/n-rg/venv/bin/InstaPy/instapy/instapy.py", line 300, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/n-rg/venv/bin/InstaPy/assets/chromedriver

@realsony you have to put chrome_options.add_argument('--no-sandbox') uncomented out of if self.headless_browser:

@timgrossmann the issue come from https://github.com/timgrossmann/InstaPy/commit/d4e3191f40598900c36a5c1b048c427044aee7b6 when headless_browser=False in instapy instance

So sorry but I think I copy and paste half of the function code
Please try this one complete function code again

def set_selenium_local_session(self):
    """Starts local session for a selenium server.
    Default case scenario."""
    if self.aborting:
        return self

    if self.use_firefox:
        if self.browser_profile_path is not None:
            firefox_profile = webdriver.FirefoxProfile(
                self.browser_profile_path)
        else:
            firefox_profile = webdriver.FirefoxProfile()

        # permissions.default.image = 2: Disable images load,
        # this setting can improve pageload & save bandwidth
        firefox_profile.set_preference('permissions.default.image', 2)

        if self.proxy_address and int(self.proxy_port) > 0:
            firefox_profile.set_preference('network.proxy.type', 1)
            firefox_profile.set_preference('network.proxy.http',
                                           self.proxy_address)
            firefox_profile.set_preference('network.proxy.http_port',
                                           self.proxy_port)
            firefox_profile.set_preference('network.proxy.ssl',
                                           self.proxy_address)
            firefox_profile.set_preference('network.proxy.ssl_port',
                                           self.proxy_port)

        self.browser = webdriver.Firefox(firefox_profile=firefox_profile)

    else:
        chromedriver_location = Settings.chromedriver_location
        chrome_options = Options()
        #chrome_options.add_argument("--disable-infobars")
        chrome_options.add_argument("--mute-audio")
        chrome_options.add_argument('--dns-prefetch-disable')
        #chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--lang=en-US')
        chrome_options.add_argument('--disable-setuid-sandbox')

        # this option implements Chrome Headless, a new (late 2017)
        # GUI-less browser. chromedriver 2.9 and above required
        if self.headless_browser:
            chrome_options.add_argument('--headless')
            # Replaces browser User Agent from "HeadlessChrome".
            user_agent = "Chrome"
            chrome_options.add_argument('user-agent={user_agent}'
                                        .format(user_agent=user_agent))
        capabilities = DesiredCapabilities.CHROME
        # Proxy for chrome
        if self.proxy_address and int(self.proxy_port) > 0:
            prox = Proxy()
            proxy = ":".join([self.proxy_address, self.proxy_port])
            prox.proxy_type = ProxyType.MANUAL
            prox.http_proxy = proxy
            prox.socks_proxy = proxy
            prox.ssl_proxy = proxy
            prox.add_to_capabilities(capabilities)

        # add proxy extension
        if self.proxy_chrome_extension and not self.headless_browser:
            chrome_options.add_extension(self.proxy_chrome_extension)

        if self.browser_profile_path is not None:
            chrome_options.add_argument('user-data-dir={}'.format(self.browser_profile_path))

        chrome_prefs = {
            'intl.accept_languages': 'en-US'
        }
        chrome_options.add_experimental_option('prefs', chrome_prefs)


        chrome_options.add_argument('--headless')
        chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument('--disable-dev-shm-usage')

        try:

            self.browser = webdriver.Chrome(chromedriver_location,chrome_options=chrome_options)

            # self.browser = webdriver.Chrome(chromedriver_location,
            #                                 desired_capabilities=capabilities,
            #                                 chrome_options=chrome_options)
        except selenium.common.exceptions.WebDriverException as exc:
            self.logger.exception(exc)
            raise InstaPyError('ensure chromedriver is installed at {}'.format(
                Settings.chromedriver_location))

        # prevent: Message: unknown error: call function result missing 'value'
        matches = re.match(r'^(\d+\.\d+)',
                           self.browser.capabilities['chrome']['chromedriverVersion'])
        if float(matches.groups()[0]) < Settings.chromedriver_min_version:
            raise InstaPyError('chromedriver {} is not supported, expects {}+'.format(
                float(matches.groups()[0]), Settings.chromedriver_min_version))

    self.browser.implicitly_wait(self.page_delay)

    message = "Session started!"
    highlight_print(self.username, message, "initialization", "info", self.logger)
    print('')

    return self

ok like this it seems to work (console says so) but I don't see a chrome instance running. Is this normal?

@realsony in your quickstart you have headless_browser=False ?

for me @idpelagos code doesnt work.

It seems to be the same here, can't start InstaPy since last update, I have this error

Message: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-130-generic x86_64)
Traceback (most recent call last):
  File "/root/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
    chrome_options=chrome_options)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-130-generic x86_64)

Traceback (most recent call last):
  File "quickstart.py", line 24, in <module>
    nogui=True)
  File "/root/InstaPy/instapy/instapy.py", line 190, in __init__
    self.set_selenium_local_session()
  File "/root/InstaPy/instapy/instapy.py", line 301, in set_selenium_local_session
    Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /root/InstaPy/assets/chromedriver

tried @idpelago 's fix, but still getting the same problem here

@idpelago thanks. Works great.
Now working perfectly. Thanks

easy fix for Debian:

@lightseb if you're using digitalocean's droplet, try reboot your droplet and try to run that instapy script again

@idpelago thanks. Works great.

Does anyone know what to do for the same issue on a raspberry pi? Because the amd64 architecture isn't compatible

@baaswietse the solution with adding code frome @idpelago it works on my raspberry pi:)

Dus you install another chrome driver? I used the 'pip-get install chromedriver'
I tried the fix from @idpelago but get the same error

@baaswietse you need to download the chromedriver from the website here : http://chromedriver.chromium.org/downloads and then extract the executable and put in the Asset folder under the instapy folder ...

be sure to download the right one ... (depends of your os version)

@baaswietse no, i had still the same chromedriver

@ilmetu there are only downloads for win32, mac64 and linux64. None of them work on rasp pi.

Traceback (most recent call last):
  File "quickstart.py", line 23, in <module>
    multi_logs=True)
  File "/home/pi/Projects/InstaPy/instapy/instapy.py", line 190, in __init__
    self.set_selenium_local_session()
  File "/home/pi/Projects/InstaPy/instapy/instapy.py", line 302, in set_selenium_local_session
    self.browser = webdriver.Chrome(chromedriver_location,chrome_options=chrome_options)
  File "/home/pi/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
    self.service.start()
  File "/home/pi/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

How is the rule here? Should i close it because one solution fixed it, or should this be closed until working code was released?

The code worked for me too.

I just did sudo apt-get --only-upgrade install google-chrome-stable and it works properly.

@idpelago fix doesn't work i think it is outdated but i still get the Error
instapy.exceptions.InstaPyError: ensure chromedriver is installed at /home/pi/InstaPy/assets/chromedriver

You can also try to install chromium-chromedriver, sudo apt install chromium-chromedriver

strange, usually it works, but today I try to run it and got the same error. Already run this command apt-get --only-upgrade install google-chrome-stable but the result is still same.

Fixed
Locate the chromer
cd /usr/local/lib/python3.6/dist-packages/instapy_chromedriver/chromedriver_linux64

Remove the version on there and download latest or downgrade version
https://chromedriver.storage.googleapis.com/index.html?path=76.0.3809.68/

Copy and paste downloaded(unzip file back to (cd /usr/local/lib/python3.6/dist-packages/instapy_chromedriver/chromedriver_linux64)

You can rename the file to chromedriver_linux64 or chromedriver_Mac64

I hope this help you fix the error

Was this page helpful?
0 / 5 - 0 ratings