I am trying to run selenium on a raspberry with debian_version 11.8 and os-release Raspbian GNU/Linux 11 (bullseye).
Python version is Python 3.9.2 installed with venv to ../bin/python3.
Chrome is installed to the rpi with sudo apt install rpi-chromium-mods
I installed selenium with python3 -m pip install selenium
without errors.
I downloaded the chromedriver, chmod +x chromedriver, put it in .myapp/bin and .myapp directory.
I installed chromium-chromedriver with sudo apt-get install chromium-chromedriver
(was it necessary? I googled it and I tried it)
I have appended the bin path that has the chromedriver to .bashrc
export PATH="/home/pi/myapp/.myapp/bin:$PATH"
By the way tried and installed conda instead of venv, to see if it does any difference, but it perplexed things even more (it downgraded python to 3.4 and i couldn’t upgrade again, I got all shorts of other problems) so I uninstalled it.
Common problem after i run python code is the following:
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.
>>> import selenium
>>> from selenium import webdriver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/myapp/.myapp/lib/python3.9/site-packages/selenium/webdriver/__init__.py", line 20, in <module>
from .chrome.webdriver import WebDriver as Chrome # noqa
File "/home/pi/myapp/.myapp/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 18, in <module>
from selenium.webdriver.chromium.webdriver import ChromiumDriver
File "/home/pi/myapp/.myapp/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 22, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "/home/pi/myapp/.myapp/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 57, in <module>
from ..common.fedcm.dialog import Dialog
ModuleNotFoundError: No module named 'selenium.webdriver.common.fedcm'
>>>
By running which selenium
or whereis selenium
with active or inactive venv I get nothing. But when looking into the ../lib/python3.9/site-packages I see selenium and other libraries in place. After this I added the /home/pi/myapp/.myapp/lib/python3.9/site-packages
explicitly to the path. Now when I issue whereis selenium
I get selenium: /home/pi/myapp/.myapp/lib/python3.9/site-packages/selenium
. However the error stays.
Is it a path thing, unsuccessful installation, environment problem? Why does the import selenium
works and not the from selenium import webdriver
Any suggestions? Something I am missing?