Instapy: Chromedriver not in the right folder

Created on 6 Sep 2018  路  19Comments  路  Source: timgrossmann/InstaPy

Hello,

I am trying to install instapy (with my limited knowledge of coding). And i followed the tutorial for ubuntu, but the same error keep coming again :
ERROR [2018-09-06 13:32:25] [wphotographiefr] 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.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-20-generic x86_64)
Traceback (most recent call last):
File "/root/InstaPy/instapy/instapy.py", line 300, 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: 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.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-20-generic x86_64)

Traceback (most recent call last):
File "quickstart.py", line 22, in
multi_logs=True,nogui=True)
File "/root/InstaPy/instapy/instapy.py", line 193, in __init__
self.set_selenium_local_session()
File "/root/InstaPy/instapy/instapy.py", line 304, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at /root/InstaPy/assets/chromedriver

I don't get it, is it a problem with chromedriver or just chrome (It seems that it is crash)
The chromedriver is in the assets folder.

Let me know if you need further informations

wontfix

Most helpful comment

Try running with headless browser
session = InstaPy(username='test', password='test', headless_browser=True)

All 19 comments

Try running with headless browser
session = InstaPy(username='test', password='test', headless_browser=True)

I just tried, and as far as im concern there is no syntax error :
File "quickstart.py", line 11
set headless_browser=True
^
SyntaxError: invalid syntax

Quickstart.py = 
import os
import time
from tempfile import gettempdir

from selenium.common.exceptions import NoSuchElementException

from instapy import InstaPy

insta_username = ''
insta_password = ''
set headless_browser=True

# set these in instapy/settings.py if you're locating the
# library in the /usr/lib/pythonX.X/ directory:
#   Settings.database_location = '/path/to/instapy.db'
#   Settings.chromedriver_location = '/path/to/chromedriver'

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

try:
    session.login()

    # settings
    session.set_relationship_bounds(enabled=False,
                 potency_ratio=-1.21,
                  delimit_by_numbers=False,
                   max_followers=4590,
                    max_following=5555,
                     min_followers=45,
                      min_following=77)
    session.set_do_comment(False, percentage=10)
    session.set_comments(['aMEIzing!', 'So much fun!!', 'Nicey!'])
    session.set_dont_include(['friend1', 'friend2', 'friend3'])
    session.set_dont_like(['pizza', 'girl'])

    # actions
    session.like_by_tags(['natgeo'], amount=1)

except Exception as exc:
    # if changes to IG layout, upload the file to help us locate the change
    if isinstance(exc, NoSuchElementException):
        file_path = os.path.join(gettempdir(), '{}.html'.format(time.strftime('%Y%m%d-%H%M%S')))
        with open(file_path, 'wb') as fp:
            fp.write(session.browser.page_source.encode('utf8'))
        print('{0}\nIf raising an issue, please also upload the file located at:\n{1}\n{0}'.format(
            '*' * 70, file_path))
    # full stacktrace when raising Github issue
    raise

finally:
    # end the bot session
    session.end()

Hey there, I am also having the same problem. I am using my Raspberry Pi3 and the error I am receiving is the same as yours, "ensure chromedriver is installed at /home/pi/Projects/InstaPy/assets/chromedriver".

I found something that I am wondering would help someone help us, and was wondering if you experience the same thing @Wielooun1 :
When I do "cd assets" and then do "ls", the response shows that there is a directory called chromedriver. After that, i performed "cd chromedriver" and despite the directory being shown previously, the response is that the directory does not exist. I am assuming that if I cannot get into the directory, the issue with the code may be that it cannot access the directory as well. Let me know if the same happens to you @Wielooun1 .

I additionally tried the headless_browser=True which did not return a syntax error, but just continued to say that chromedriver was not in the right directory

If anyone can help us figure out why this is happening, it would be great.

chromedriver is not a directory, and you are suppose to get chromedriver and put it inside the assets folder.
You may try making chromedriver executable by:

chmod +x InstaPy/assets/chromedriver
chmod 755 InstaPy/assets/chromedriver

and for @Wielooun1 , his error is because headless browser = true should be inside your session func call, not inserting it as a new line. Please read the instructions.
https://github.com/timgrossmann/InstaPy/blob/master/docs/How_To_DO_Ubuntu_on_Digital_Ocean.md

Still does not work, in fact this made the same error occur and an additional that says "DevToolsActivePort file doesn't exist" and "The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed."

Ideas?

Same problem here. Have followed all the guides I have found here. Read through dossens of similar issues. Used Google. Applied own knowledge. But still get the same error message.

Has noothing to do with InstaPy......a Chromedrive problem.....starting chromedriver and doing a

curl -XPOST http://localhost:9515/session -d '{"desiredCapabilities":{"browserName":"chrome"}}'

gives me the same error

i had the same problem and was because i had two chromium browsers install, i executed

sudo apt-get remove chromium

After that i could execute python quickstart.py without problem馃馃徏

@waltermazzariol if you don't mind me asking, did removing chromium remove both? In other words, did you have to reinstall after or did it just remove one and instantly solve the problem?

@arcasoy No, only remove the version i installed with the tutotial.

The solution for me seems to be the combination of chromium and chromedriver. These versions seems to work together:
Chromium 65.0.3325.181 Built on Raspbian , running on Raspbian 9.4

ChromeDriver 2.36 (a81166ad79e68fbfe7cf5ba243192d6412e26b37)

Same error

The version of chromedriver I had was 2.4 so i reverted back to 2.36 to see if that would fix anything. Whenever I try to run chromedriver now with ./chromedriver I am getting bash: ./chromedriver: cannot execute binary file: Exec format error. This is truly stumping me. I'd like to point out that I have all of the versions you mentioned above @meinert but now chromedriver is not working at all.

^also going to add that i ensured that I have the right build, 32bit, of chromedriver installed.

The solution for me seems to be the combination of chromium and chromedriver. These versions seems to work together:
Chromium 65.0.3325.181 Built on Raspbian , running on Raspbian 9.4

ChromeDriver 2.36 (a81166ad79e68fbfe7cf5ba243192d6412e26b37)

How is it possible to get these versions of Chromium and ChromeDriver?

same question, how do I get this version? a81166ad79e68fbfe7cf5ba243192d6412e26b37

Guys please check #2678

I fixed it with sudo apt --fix-broken install . Seems like dependencies were missing even though I followed the how to install on Ubuntu 64.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thisishotdog picture thisishotdog  路  3Comments

harrypython picture harrypython  路  3Comments

CharlesCCC picture CharlesCCC  路  3Comments

46960 picture 46960  路  3Comments

Naramsim picture Naramsim  路  3Comments