Selenium firefox webdriver with virtualenv: Exec format error

1.2k views Asked by At

I am using Selenium and Virtualenv in Ubuntu14.04 to scrape some code on webpage. After making a virtualenv directory, while activating virtualenv using source bin/activate, I installed selenium, headless firefox, pyvirtualdisplay and firefox geckodriver.

I installed headless firefox according to here.

And I also Found out that there are different python2.7 folders at "/usr/lib/python2.7/" and "~/ladder_selenium/lib/python2.7" (ladder_selenium is the Virtualenv directory)

and after I ran a python code which contains

from selenium import webdriver

, the error below happens.

Traceback (most recent call last):
  File "predict.py", line 12, in <module>
driver = webdriver.Firefox()
  File "/home/heyjude/ladder_selenium/local/lib/python2.7/site-packages/selenium/webdriver/f
self.service.start()
  File "/home/heyjude/ladder_selenium/local/lib/python2.7/site-packages/selenium/webdriver/c
stdout=self.log_file, stderr=self.log_file)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

Could you tell me what to fix?

EDIT for the COMMENT BELOW:

(ladder_selenium) heyjude@ladder-selenium:~$ export DISPLAY=:99
(ladder_selenium) heyjude@ladder-selenium:~$ firefox
XPCOMGlueLoad error for file /opt/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
0

There are 0 answers