I am building a Code that will run on a cloud server, IT uses Python and mainly Selenium and Chrome driver.
I have prepared a Docker File for Unzipping The Chrome Driver and storing it to the “./tmp/local/” path for using the Chrome driver for Information Extraction I am running into same problem again and again after trying everything,
- Changing Code Tried.
- Changing File name tried.
- Gemini Tried.
- ChatGPT Tried.
DOCKER FILE:
# First, specify the base Docker image.
# You can see the Docker images from Apify at https://hub.docker.com/r/apify/.
# You can also use any other image from Docker Hub.
FROM apify/actor-python:3.11
#https://developer.chrome.com/docs/chromedriver/downloads#chromedriver_1140573590
# Install Chrome, ChromeDriver, and necessary dependencies
RUN apt-get update
&& apt-get install -y wget gnupg unzip curl || exit 1
# Add Google Chrome repository key
# Check exit code and exit if there's an error
RUN apt-key add - <<< "$(wget -qO- https://dl.google.com/linux/linux_signing_key.pub)" || exit 1
# Add Google Chrome repository list
# Check exit code and exit if there's an error
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list || exit 1
# Update package lists
RUN apt-get update || exit 1
# Install Google Chrome
RUN apt-get install -y google-chrome-stable || exit 1
# Get Chrome version
# Use grep with -E flag for extended regex
RUN CHROME_VERSION=$(google-chrome --version | grep -Eo '[0-9.]+') || exit 1
# Get ChromeDriver version (use dedicated script)
RUN curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE | grep -oE '[0-9.]+' > /tmp/chromedriver_version || exit 1
# Download ChromeDriver
RUN CHROMEDRIVER_VERSION=$(cat /tmp/chromedriver_version) &&
wget -O /tmp/chromedriver.zip https://storage.googleapis.com/chrome-for-testing-public/125.0.6422.141/linux64/chromedriver-linux64.zip || exit 1
# Extract ChromeDriver and add to PATH
RUN unzip /tmp/chromedriver-linux64 chromedriver -d /usr/local/bin/ &&
rm /tmp/chromedriver-linux64 || exit 1
# Clean apt cache
RUN apt-get clean || exit 1
# Remove temporary files
RUN rm -rf /var/lib/apt/lists/* || exit 1
# Set environment variable for ChromeDriver
ENV PATH="/usr/local/bin/chromedriver:${PATH}"
# Second, copy just requirements.txt into the Actor image,
# since it should be the only file that affects the dependency install in the next step,
# in order to speed up the build
COPY requirements.txt ./
# Install the packages specified in requirements.txt,
# Print the installed Python version, pip version
# and all installed packages with their versions for debugging
RUN echo "Python version:"
&& python --version
&& echo "Pip version:"
&& pip --version
&& echo "Installing dependencies:"
&& pip install -r requirements.txt
&& echo "All installed Python packages:"
&& pip freeze
# Next, copy the remaining files and directories with the source code.
# Since we do this after installing the dependencies, quick build will be really fast
# for most source file changes.
COPY . ./
# Use compileall to ensure the runnability of the Actor Python code.
RUN python3 -m compileall -q .
# Specify how to launch the source code of your Actor.
# By default, the "python3 -m src" command is run
CMD ["python3", "-m", "src"]
ERROR I AM RUNNING INTO:
2024-06-07 05:46:29 (192 MB/s) - ‘/tmp/chromedriver.zip’ saved [8713889/8713889]
2024-06-07T05:46:31.155Z
2024-06-07T05:46:31.157Z Removing intermediate container 7e0f2da2c984
2024-06-07T05:46:31.158Z ---> a0df0f183e40
2024-06-07T05:46:31.160Z Step 10/19 : RUN unzip /tmp/chromedriver-linux64 chromedriver -d /usr/local/bin/ && rm /tmp/chromedriver-linux64 || exit 1
2024-06-07T05:46:31.161Z ---> Running in 37b80f2430f9
2024-06-07T05:46:31.379Z unzip: cannot find or open /tmp/chromedriver-linux64, /tmp/chromedriver-linux64.zip or /tmp/chromedriver-linux64.ZIP.
Please resolve this ERROR for me it is too important needs to be delivered in this week!
I have prepared a Docker File for Unzipping The Chrome Driver and storing it to the “./tmp/local/” path for using the Chrome driver for Information Extraction I am running into same problem again and again after trying everything,
- Changing Code Tried.
- Changing File name tried.
- Gemini Tried.
- ChatGPT Tried.
The result it gave me was the same error again, the “FILE NOT FOUND”
it is not able to extract the correct file from the Unzipped Folder!
Lokesh Agarwal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.