Cynic
Cynic

Reputation: 7276

Selenium Python: No such file or directory: '/usr/local/bin/chromedriver' but it exists and is added to path

Trying to run selenium python on a Docker Apline Linux and getting the "Message: 'chromedriver' executable needs to be in PATH" error because it thinks the file doesn't exist. But tried everything I can fine in other answers, but it still won't launch.

Here's what I tried so far:

See error. in a docker un of image

Update: Adding these packages in Docker file.

RUN apk --update --no-cache add\
  alpine-sdk\
  autoconf\
  automake\
  bash\
  binutils-gold\
  build-base\
  curl\
  dumb-init\
  g++\
  gcc\
  gcompat\
  git\
  gnupg\
  gzip\
  jpeg\
  jpeg-dev\
  libc6-compat\
  libffi\
  libffi-dev\
  libpng\
  libpng-dev\
  libstdc++\
  libtool\
  linux-headers\
  make\
  mysql\
  mysql-client\
  mysql-dev\
  mesa-gles\
  nasm\
  nodejs\
  nss\
  openjdk8-jre\
  openssh-client\
  paxctl\
  python3\
  python3-dev\
  sudo\
  tar\
  unzip\
  wget\
  chromium

And the shell script I'm getting Chromedriver with

#!/bin/bash

LATEST_CHROMEDRIVER=$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
curl -L https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER/chromedriver_linux64.zip >> chromedriver.zip
mv -f chromedriver.zip /usr/local/bin/chromedriver.zip
unzip /usr/local/bin/chromedriver.zip -d /usr/local/bin
chmod a+x /usr/local/bin/chromedriver
sudo ln -s /usr/local/bin/chromedriver /usr/bin/chromedriver
rm /usr/local/bin/chromedriver.zip

Upvotes: 2

Views: 6965

Answers (1)

valiano
valiano

Reputation: 18621

The output from ldd suggests that chromedriver is built against glibc (GNU standard C library), which isn't compatible to vanilla Alpine, using musl libc.

To fix this, try installing the Alpine compatible version of chromedriver, available in Alpine repositories, using apk add chromium-chromedriver:

https://pkgs.alpinelinux.org/package/v3.9/community/x86_64/chromium-chromedriver

Upvotes: 3

Related Questions