Help adding .exe to $PATH


In order to scrape some images for an Image Classification example, I would like to use Selenium and Chromedriver or, maybe better, Geckodriver. See the below example:

from selenium import webdriver

options = webdriver.ChromeOptions()
#options.binary_location = “/home/work/hslu-deep-learning/notebooks/Block 5/Selenium test/chromedriver”
driver = webdriver.Chrome(chrome_options=options)


images = driver.find_elements_by_tag_name(‘img’)
for image in images:


Error message:
WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH.

The problem now is, that I need to add the executable to PATH. I tried various ways to achive this, with no succes. Could somebody give me advice? Or is adding executables to PATH just not allowed?

Thanks in advance for any help!


Hello @simonvanhemert,

You can update your path in the Dockerfile. This is the syntax:

ENV PATH "$PATH:/path/to/your/chromedriver"

If you are working from an interactive environment in RenkuLab, remember you need to commit and push your code to build the new Docker image. You can then start a new environment from the latest commit you just pushed.

Hi Lorenzo,

Thank you for the super fast reply! That I should edit the dockerfile is already a great help.
However, I did not manage to find the solution jet. I tried all of the next options:

#add chromedriver and geckodriver to PATH
ENV PATH “PATH:/home/work/hslu-deep-learning/notebooks/Block_5/Seleniumtest/chromedriver" ENV PATH="/home/work/hslu-deep-learning/notebooks/Block_5/Seleniumtest/geckodriver:{PATH}”
ENV PATH=“notebooks/Block_5/Seleniumtest/chromedriver:${PATH}”
ENV PATH “$PATH:/notebooks/Block_5/Seleniumtest/geckodriver”

The Dockerbuild log shows:

Step 4/7 : ENV PATH "$PATH:/home/work/hslu-deep-learning/notebooks/Block_5/Seleniumtest/chromedriver" ---> Using cache ---> 2e87e953d7cc Step 5/7 : ENV PATH="/home/work/hslu-deep-learning/notebooks/Block_5/Seleniumtest/geckodriver:${PATH}" ---> Using cache ---> 0fd78b5fb2e2 Step 6/7 : ENV PATH="notebooks/Block_5/Seleniumtest/chromedriver:${PATH}" ---> Running in 39dda5120c5a Removing intermediate container 39dda5120c5a ---> 7aebddc07fe4 Step 7/7 : ENV PATH "$PATH:/notebooks/Block_5/Seleniumtest/geckodriver" ---> Running in 63762dcfb350 Removing intermediate container 63762dcfb350 ---> 27fa4d268876 Successfully built 27fa4d268876

I hope you can help me further.

The commands you added seem to work.

I’m not very familiar with how you are trying to access the chromedriver from a Jupyter notebook. Are you sure the paths you are adding exist and contain what you need?
I would install the packages required by selenium (chromedriver or geckodriver, and any other necessary package) using apt-get in the Dockerfile.
You should already have a commented section like the following one:

# Uncomment and adapt if your R or python packages require extra linux (ubuntu) software
# e.g. the following installs apt-utils and vim; each pkg on its own line, all lines
# except for the last end with backslash '\' to continue the RUN line
# USER root
# RUN apt-get update && \
#    apt-get install -y --no-install-recommends \
#    apt-utils \
#    vim

You can uncomment those 3 commands and swap vim with the required packages.
I hope this helps.

Thank you for your support! This solved my problem. Installing the package in the Dockerfile already adds the .exe to $PATH.

1 Like