CondaHTTPError when building docker image

Hello,

My CI pipeline fails due to a CondaHTTPError.

Very concisely:

  1. My .gitlab-ci.yml gets to the command:
    docker build --pull -t "$CI_REGISTRY_IMAGE/image_name" -f dockerfile_name .
  2. The dockerfile commands start running and it fails at the command (full dockerfile at the bottom):
RUN conda create --yes --name my_env -c conda-forge python=3.11.5

Error message:

Step 6/11 : RUN conda create --yes --name my_env -c conda-forge python=3.11.5
 ---> Running in ea01f18dd131
Channels:
 - conda-forge
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): ...working... failed
CondaHTTPError: HTTP 429 TERMS OF SERVICE RATE LIMIT EXCEEDED for url <https://repo.anaconda.com/pkgs/main/linux-64/repodata.json>
Elapsed: 00:06.320422
CF-RAY: 8841de1e1aa0baf4-MXP
Your usage of the Anaconda package repository exceeds our rate limits.  Please see https://www.anaconda.com/tos-access

I could run the same pipeline successfully copying the repository into a personal GitLab account.
Please let me know if I am missing something.

Thank you very much,
Sergio


Full dockerfile:

########################################################
#        Renku install section - do not edit           #

FROM renku/renkulab-py:3.10-0.22.0 as builder

# RENKU_VERSION determines the version of the renku CLI
# that will be used in this image. To find the latest version,
# visit https://pypi.org/project/renku/#history.
ARG RENKU_VERSION=2.9.2

# Install renku from pypi or from github if a dev version
RUN if [ -n "$RENKU_VERSION" ] ; then \
        source .renku/venv/bin/activate ; \
        currentversion=$(renku --version) ; \
        if [ "$RENKU_VERSION" != "$currentversion" ] ; then \
            pip uninstall renku -y ; \
            gitversion=$(echo "$RENKU_VERSION" | sed -n "s/^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\(rc[[:digit:]]\+\)*\(\.dev[[:digit:]]\+\)*\(+g\([a-f0-9]\+\)\)*\(+dirty\)*$/\4/p") ; \
            if [ -n "$gitversion" ] ; then \
                pip install --no-cache-dir --force "git+https://github.com/SwissDataScienceCenter/renku-python.git@$gitversion" ;\
            else \
                pip install --no-cache-dir --force renku==${RENKU_VERSION} ;\
            fi \
        fi \
    fi
#             End Renku install section                #
########################################################

FROM renku/renkulab-py:3.10-0.22.0

# Use an official Python runtime as a parent image
FROM continuumio/miniconda3:latest

# Create and activate a Conda environment
RUN conda create --yes --name my_env -c conda-forge python=3.11.5

# Set the working directory name
WORKDIR / myworkdir

# Copy the current directory contents into the container
COPY . /myworkdir

RUN /bin/bash -c "source activate my_env\
 && conda install -c conda-forge  --yes --file requirements.txt\
 && pip install /myworkdir"

# Make port 8050 available to the world outside this container
EXPOSE 8050

# Define environment variable
# ENV NAME World

# Run app.py when the container launches
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "my_env", "python", "app.py"]

Hi @SerAcero,

Could you please remove the defaults channel from your environment.yml file and check again? This issue may be related to the point we shared here. Let us know if you have further issues.

Hi Elisabet!

Thanks for your answer. I do not know why, but removing the defaults channel (and adding conda-forge) from the environment.yml did not seem to do anything. During build, both channels still appeared:

Channels:
- conda-forge
- defaults

I finally fixed it by removing the defaults channel explicitly from the dockerfile:

RUN conda config --remove channels defaults
RUN conda config --add channels conda-forge

Thanks for your help!

Hi Sergio! Thank you for sharing your solution. It is weird that committing the changes in environment.yml and rebuilding the image did not work. It was maybe an old project template.
Do not hesitate to reach out to us in case you have any issue or doubt.