Instapy: ERROR Message: unknown error: DevToolsActivePort file doesn't exist

Created on 4 Jul 2018  路  29Comments  路  Source: timgrossmann/InstaPy

Please someone has this problem? What are you talking?

(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.9.0-5-amd64 x86_64)
Traceback (most recent call last):
File "/var/www/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.9.0-5-amd64 x86_64)

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

Most helpful comment

uncomment line

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

in your instapy.py

should fix your problem.

All 29 comments

getting same error here after updating. tried updating chrome driver as well. currently running 2.40

same here, running chromedriver v2.40

```ERROR [2018-07-04 08:49:13] [myname] Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 3.10.0-862.2.3.el7.x86_64 x86_64)
Traceback (most recent call last):
File "/home/user/InstaPy/instapy/instapy.py", line 297, in set_selenium_local_session
chrome_options=chrome_options)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
desired_capabilities=desired_capabilities)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/lib/python2.7/site-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 3.10.0-862.2.3.el7.x86_64 x86_64)

Traceback (most recent call last):
File "quickstart.py", line 24, in
multi_logs=True)
File "/home/user/InstaPy/instapy/instapy.py", line 190, in __init__
self.set_selenium_local_session()
File "/home/user/InstaPy/instapy/instapy.py", line 301, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/user/InstaPy/assets/chromedriver
```
before updating the new code today everything was OK.
Bye.

Same for me after update ...

Same for me

uncomment line

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

in your instapy.py

should fix your problem.

@ilmetu thanks! It works!

@ilmetu Thanks! 馃憦馃徏

Pulled from master / has uncommented line, same issue.

I have this problem too - was this fixed to some newer version? If yes - what version?

Same issue (chrome_options.add_argument('--no-sandbox') is already uncommented). Trying to run on ubuntu 16

same problem here, fresh install via venv:

ERROR [2018-07-10 23:20:19] [username]  Message: unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-042stab131.1 x86_64)
Traceback (most recent call last):
  File "/home/jonas/venv/local/lib/python2.7/site-packages/instapy/instapy.py", line 297, in set_selenium_local_session
    chrome_options=chrome_options)
  File "/home/jonas/venv/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/jonas/venv/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/jonas/venv/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/home/jonas/venv/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/home/jonas/venv/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, 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-042stab131.1 x86_64)

Traceback (most recent call last):
  File "quickstart.py", line 17, in <module>
    nogui=True)
  File "/home/jonas/venv/local/lib/python2.7/site-packages/instapy/instapy.py", line 190, in __init__
    self.set_selenium_local_session()
  File "/home/jonas/venv/local/lib/python2.7/site-packages/instapy/instapy.py", line 301, in set_selenium_local_session
    Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /home/jonas/venv/local/lib/python2.7/site-packages/assets/chromedriver

@ilmetu

uncomment line

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

in your instapy.py

should fix your problem.

@Daviwp that's already uncommented on master, bud. FYI https://github.com/timgrossmann/InstaPy/blob/master/instapy/instapy.py#L267

enabling this --no-sandbox doesn't help!

I also tried adding --disable-dev-shm-usage (as recommended here) but this didn't fix it aswell fyi.

pull master repository

@Daviwp i pulled it yesterday and since then there are no new commits on master, so this doesn't help until you specify your meanings with "pull master repository". Thank you.

Quick update: i didn't set headless_browser=True just nogui=True. Setting both to True solved this concrete problem for me.

Adding --no-sandbox solved the issue! Was Stuck for 6 days

  1. add argument to options "--no-zygote" when used "--no-sandbox"
    or
  2. jus like @ilmetu said, uncomment line
    > chrome_options.add_argument('--no-sandbox')

both them works for me well, chrome=67, chromedriver=2.40 on MacBook 10.13.3

Reference:

https://peter.sh/experiments/chromium-command-line-switches/
--no-zygote

Disables the use of a zygote process for forking child processes. Instead, child processes will be forked and exec'd directly. Note that --no-sandbox should also be used together with this flag because the sandbox needs the zygote to work.

I solved this error for myself by commenting out chrome_options.add_argument('--disable-setuid-sandbox') and setting nogui=True
I'm on chrome=68, chromedriver=2.41, OS=Linux Debian

Add the above mentioned arguments, and install the corresponding browser. Headless mode requires the driver and the browser both installed on the system.

I followed this thread and related stackoverflow questions but still can't make it work even with all combination of options mentionned above :
--no-sandbox
--disable-dev-shm-usage
--disable-setuid-sandbox
Running with headless_browser=True just nogui=True.

It works perfectly on my mac os 10.14.1 but always get an issue when running from a fresh raspberry install (chromedriver and chromium versions are chosen to be compatible). Any hints from you guys who finally got it to work ?

@Romain-C Try installing the chrome / chromium browser completely through CLI.

@omkar-dsd Thanks but indeed I try to install everything through CLI :(
After reading the RASPI documentation and many feedbacks/stackoverflows it looks like there is a confusion between the 'chromium' and the 'chromium-browser' packages.
Also there are many different install issues about the way of installing the driver itself.
Well so far everything working fine from my mac but can't make it work from a fresh Raspberry PI3b+

just change headless_browser=True

session = InstaPy(username=insta_username,
                  password=insta_password,
                  headless_browser=True, nogui=True)

use centos-release-7-2.1511.el7.centos.2.10.x86_64 my problem solved

cant find this line

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

please what line is it on?

I run my tests on a CI server (Jenkins) with Linux remotely without a display with pytest.
Installing pytest-xvfb fixed the problem for me. It works regardless headless true or false for Chrome.
pip install pytest-xvfb==1.2.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ediooo picture ediooo  路  3Comments

ingorichter picture ingorichter  路  3Comments

wyvers picture wyvers  路  3Comments

Spyd3r0us picture Spyd3r0us  路  3Comments

harrypython picture harrypython  路  3Comments