InstaPy icon indicating copy to clipboard operation
InstaPy copied to clipboard

Geckodriver not working on Raspberry Pi

Open Wolkex3 opened this issue 2 years ago • 9 comments

I am trying to install InstaPy on the Raspberry Pi (raspbian).

I'm not sure whether instapy is calling the correct gckodriver from usr/local/bin. How can I ensure this? Path is:

/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

But I'm getting following error.

InstaPy Version: 0.6.16
 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
Workspace in use: "/home/pi/InstaPy"
Traceback (most recent call last):
  File "/home/pi/quickstart.py", line 12, in <module>
    session = InstaPy(username=insta_username,
  File "/home/pi/.local/lib/python3.9/site-packages/instapy/instapy.py", line 330, in __init__
    self.browser, err_msg = set_selenium_local_session(
  File "/home/pi/.local/lib/python3.9/site-packages/instapy/browser.py", line 123, in set_selenium_local_session
    browser = webdriver.Firefox(
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    self.service.start()
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /usr/local/bin/geckodriver unexpectedly exited. Status code was: 1

Even starting geckodriver directly is not working.

pi@raspberrypi:~ $ python3
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> browser = webdriver.Firefox()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 173, in __init__
    self.service.start()
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 1

Geckodriver version used:

pi@raspberrypi:~ $ geckodriver --version
geckodriver 0.23.0 ( 2018-10-04)

Geckodriver Log:

error: Found argument '--websocket-port' which wasn't expected, or isn't valid in this context

USAGE:
    geckodriver [FLAGS] [OPTIONS]

For more information try --help

Selenium version

VERSION
    4.1.1

FF 91.6.0esr (32bit)


Wolkex3 avatar Feb 26 '22 16:02 Wolkex3

Yeah, it's an old helper app, but updated raspbian... I had to install Ubuntu on my Rpi to run headless.

mikestan avatar Feb 27 '22 22:02 mikestan

Yeah, it's an old helper app, but updated raspbian... I had to install Ubuntu on my Rpi to run headless.

Ah, that is the reason! Thanks for the hint. This should be added to the installation guide.

How did you install Ubuntu on rpi and which Ubuntu version? Which installation guidelines did you used? Thanks a lot!

Wolkex3 avatar Feb 28 '22 07:02 Wolkex3

Yeah, it's an old helper app, but updated raspbian... I had to install Ubuntu on my Rpi to run headless.

Ah, that is the reason! Thanks for the hint. This should be added to the installation guide.

How did you install Ubuntu on rpi and which Ubuntu version? Which installation guidelines did you used? Thanks a lot!

Use the Raspberry Pi imager --> Choose "Choose OS" --> Other General Purpose OS --> Ubuntu --> I chose Ubuntu Server 21.10/64bit (after install you need to add a swap file for stability). This should get you running...

mikestan avatar Mar 02 '22 10:03 mikestan

Yeah, it's an old helper app, but updated raspbian... I had to install Ubuntu on my Rpi to run headless.

Ah, that is the reason! Thanks for the hint. This should be added to the installation guide.

How did you install Ubuntu on rpi and which Ubuntu version? Which installation guidelines did you used? Thanks a lot!

Use the Raspberry Pi imager --> Choose "Choose OS" --> Other General Purpose OS --> Ubuntu --> I chose Ubuntu Server 21.10/64bit (after install you need to add a swap file for stability). This should get you running...

Thanks Mike! I just have a rpi 3+. Will it work on rpi3+ or do I need to get a rpi4?

Best

Wolkex3 avatar Mar 02 '22 10:03 Wolkex3

Yeah, it's an old helper app, but updated raspbian... I had to install Ubuntu on my Rpi to run headless.

Ah, that is the reason! Thanks for the hint. This should be added to the installation guide.

How did you install Ubuntu on rpi and which Ubuntu version? Which installation guidelines did you used? Thanks a lot!

Use the Raspberry Pi imager --> Choose "Choose OS" --> Other General Purpose OS --> Ubuntu --> I chose Ubuntu Server 21.10/64bit (after install you need to add a swap file for stability). This should get you running...

Thanks Mike! I just have a rpi 3+. Will it work on rpi3+ or do I need to get a rpi4?

Best

Mine is an rpi 3B v1.2, so the above should still work - check out HW comparison articles, if you have issues, tho.

mikestan avatar Mar 02 '22 13:03 mikestan

Yeah, it's an old helper app, but updated raspbian... I had to install Ubuntu on my Rpi to run headless.

Ah, that is the reason! Thanks for the hint. This should be added to the installation guide.

How did you install Ubuntu on rpi and which Ubuntu version? Which installation guidelines did you used? Thanks a lot!

Use the Raspberry Pi imager --> Choose "Choose OS" --> Other General Purpose OS --> Ubuntu --> I chose Ubuntu Server 21.10/64bit (after install you need to add a swap file for stability). This should get you running...

Thanks Mike! I just have a rpi 3+. Will it work on rpi3+ or do I need to get a rpi4? Best

Mine is an rpi 3B v1.2, so the above should still work - check out HW comparison articles, if you have issues, tho.

Hi Mike, which install guide should I follow? RPI or Ubuntu? Ubuntu guide is two year old and is using chrome?

Wolkex3 avatar Mar 08 '22 19:03 Wolkex3

I have now got myself a RPI4 and installed Ubuntu Server. Unfortunately I get the following error message that I do not understand. Apparently Geckodriver is not found. However, there is Geckodriver in the folder. Can you help me further?

Echo Path looks good, right?

pi@ubuntu:~$ python3 quickstart.py
InstaPy Version: 0.6.16
 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.
Workspace in use: "/home/pi/InstaPy"
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/geckodriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/quickstart.py", line 28, in <module>
    session = InstaPy(username='Account', password='Pass', headless_browser=True)
  File "/home/pi/.local/lib/python3.9/site-packages/instapy/instapy.py", line 330, in __init__
    self.browser, err_msg = set_selenium_local_session(
  File "/home/pi/.local/lib/python3.9/site-packages/instapy/browser.py", line 123, in set_selenium_local_session
    browser = webdriver.Firefox(
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 173, in __init__
    self.service.start()
  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

pi@ubuntu:~$ sudo cp geckodriver /usr/local/bin/
[sudo] password for pi:
pi@ubuntu:~$ ls
geckodriver  geckodriver.log  geckodriver-v0.23.0-arm7hf.tar.gz  InstaPy  quickstart.py
pi@ubuntu:~$ cd /usr/local/bin/
pi@ubuntu:/usr/local/bin$ ls
geckodriver  pip  pip3  pip3.9
pi@ubuntu:/usr/local/bin$ cd
pi@ubuntu:~$ ls
geckodriver  geckodriver.log  geckodriver-v0.23.0-arm7hf.tar.gz  InstaPy  quickstart.py
pi@ubuntu:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
pi@ubuntu:~$

Wolkex3 avatar Mar 08 '22 20:03 Wolkex3

@mikestan Hi Mike, I installed ubuntu on my rpi4. And having issues with hide selenium. Which Firefox and geckodriver version did you have installed? And how? I'm pretty new in this environment. Can you help me to fix this issue?

https://github.com/InstaPy/InstaPy/issues/6552

Wolkex3 avatar Mar 12 '22 13:03 Wolkex3

I have now got myself a RPI4 and installed Ubuntu Server. Unfortunately I get the following error message that I do not understand. Apparently Geckodriver is not found. However, there is Geckodriver in the folder. Can you help me further?

Echo Path looks good, right?


pi@ubuntu:~$ python3 quickstart.py

InstaPy Version: 0.6.16

 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.

Workspace in use: "/home/pi/InstaPy"

Traceback (most recent call last):

  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 71, in start

    self.process = subprocess.Popen(cmd, env=self.env,

  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__

    self._execute_child(args, executable, preexec_fn, close_fds,

  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child

    raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/geckodriver'



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "/home/pi/quickstart.py", line 28, in <module>

    session = InstaPy(username='Account', password='Pass', headless_browser=True)

  File "/home/pi/.local/lib/python3.9/site-packages/instapy/instapy.py", line 330, in __init__

    self.browser, err_msg = set_selenium_local_session(

  File "/home/pi/.local/lib/python3.9/site-packages/instapy/browser.py", line 123, in set_selenium_local_session

    browser = webdriver.Firefox(

  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 173, in __init__

    self.service.start()

  File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 81, in start

    raise WebDriverException(

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.



pi@ubuntu:~$ sudo cp geckodriver /usr/local/bin/

[sudo] password for pi:

pi@ubuntu:~$ ls

geckodriver  geckodriver.log  geckodriver-v0.23.0-arm7hf.tar.gz  InstaPy  quickstart.py

pi@ubuntu:~$ cd /usr/local/bin/

pi@ubuntu:/usr/local/bin$ ls

geckodriver  pip  pip3  pip3.9

pi@ubuntu:/usr/local/bin$ cd

pi@ubuntu:~$ ls

geckodriver  geckodriver.log  geckodriver-v0.23.0-arm7hf.tar.gz  InstaPy  quickstart.py

pi@ubuntu:~$ echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

pi@ubuntu:~$

Hi @mikestan which FF version you use?

Wolkex3 avatar Mar 13 '22 07:03 Wolkex3