Skip to content

Need additional installs/config to work on Alpine #3

@Mosterhout

Description

@Mosterhout

Install issues/process change on Alpine 3.21 - Not really an issue with the code more my system but wanted to share for others

Issue 1 - libc6-compat
when trying to execute the script i was getting a file not found error:
Traceback (most recent call last):
File "/home/user/Micro-Center-Stock-Application/MCSA.py", line 156, in
main()
File "/home/user/Micro-Center-Stock-Application/MCSA.py", line 150, in main
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in init
super().init(
File "/home/user/.local/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 55, in init
self.service.start()
File "/home/user/.local/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 104, in start
self._start_process(self._path)
File "/home/user/.local/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 214, in _start_process
self.process = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver'

On alpine containers, having the not found error is a typical symptom of dynamic link failure. We need to bear in mind that alpine uses the musl libc library so if the executable is looking for glibc executables it won't find them.

I am running this on Alpine 3.21 and had to install libc6-compat.

Issue 2 - chromedriver unexpectedly exited. Status code was: 127
Running "chromedriver --version" told me i was missing the following librarys
shared library libnss3.so
shared library libnssutil3.so
shared library libnspr4.so
shared library libxcb.so.1

Fixed libnss3.so, libnssutil3.so, libnspr4.so with "apk add nss"

Fixed libxcb.so.1 with "apk add libxcb"

Issue 3 - need to install Chrome
apk add chromium

Issue4 - This version of ChromeDriver only supports Chrome version 114
need to add the following line to the top section of MCSA.py:
from webdriver_manager.core.os_manager import ChromeType

Also needed to replace the following line
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
WITH
driver = webdriver.Chrome(service=Service(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()), options=chrome_options )

Then i was able to get the script work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions