Skip to content

fix broken Docker image build #45889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 17, 2022

Conversation

rendner
Copy link
Contributor

@rendner rendner commented Feb 9, 2022

This PR adds a missing flag to successfully build the pandas Docker image.

@rendner rendner changed the title add "--no-build-isolation" to pip install gix broken Docker image build Feb 9, 2022
@rendner rendner changed the title gix broken Docker image build fix broken Docker image build Feb 9, 2022
@NumberPiOso
Copy link
Contributor

I have not tested the environment itself, but I could build the docker image properly.

docker build --tag pandas-pr45807-env .
Successfully built ba38c2d0969f
Successfully tagged pandas-pr45807-env:latest

I think a test to test the build of this image could avoid the same mistake.

@jreback
Copy link
Contributor

jreback commented Feb 11, 2022

sure would welcome a test of this.

@jreback jreback added the Build Library building on various platforms label Feb 11, 2022
@jreback jreback added this to the 1.5 milestone Feb 11, 2022
@rendner
Copy link
Contributor Author

rendner commented Feb 11, 2022

@jreback

sure would welcome a test of this.

I expect that the the test is a shell script which runs only docker build --tag pandas-dev-env . (maybe with --no-cache?)

Can you give me a pointer where I should create such a test?

@mroeschke
Copy link
Member

Can you give me a pointer where I should create such a test?

Maybe the easiest thing is to create a "no-op" Github action (in code-checks.yml) that builds the Dockerfile: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action

@rendner
Copy link
Contributor Author

rendner commented Feb 12, 2022

@mroeschke I created a new job in the mentioned code-checks.yml.

I have run the new build job twice and both failed:

Both failed with the same CondaHTTPError: HTTP 404 NOT FOUND errors:

CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/charset-normalizer-2.0.11-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.4-pyh9f0ad1d_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/idna-3.3-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/pip-22.0.3-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/pycparser-2.21-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/pyopenssl-22.0.0-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/requests-2.27.1-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/six-1.16.0-pyh6c4a22f_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/tqdm-4.62.3-pyhd8ed1ab_0.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/urllib3-1.26.8-pyhd8ed1ab_1.conda
CondaHTTPError: HTTP 404 NOT FOUND for url https://conda.anaconda.org/conda-forge/noarch/wheel-0.37.1-pyhd8ed1ab_0.conda

Is there something wrong?

Another problem which I currently see is that in the Dockerfile the main branch is used to build the Docker image. Therefore, changes in a PR outside of the Dockerfile are only taken into account after they are merged into the main branch. This means that even if the job runs successfully for a PR, it can fail after the merge into the main branch.

@mroeschke
Copy link
Member

For the 404, maybe make sure -c conda-forge is passed when installing the deps from environment.yml.

I'm guessing this Dockerfile shouldn't change much ideally so I think it's a good first pass test for this PR

@rendner rendner force-pushed the pr-45807-fix_broken_docker_image branch from f18224b to b80334d Compare February 13, 2022 21:24
@rendner
Copy link
Contributor Author

rendner commented Feb 15, 2022

@mroeschke
For me it looks like that the conda-forge channel is used (as configured). The problem seems to be that it tries to download non-existing conda files instead of the existing tar.bz2 files.

What I tried in the meantime:

Since I am not familiar with conda and mamba, I would need help at this point. I have enabled additional debug output. Here is the output of the last failed build:

Maybe you can find something. Building the Dockerfile via docker build ... works on my local machine.
I also recognized that the Dockerfile and the ci/setup_env.sh use different steps to configure the setup.

@mroeschke
Copy link
Member

For now, I think it's best to just make the Dockerfile changes here and open a new issue about testing the Dockerfile in the CI (i.e. revert the Github Action job changes).

I don't use the Dockerfile for local development so I am not sure where the issue might be

@rendner
Copy link
Contributor Author

rendner commented Feb 15, 2022

I digged a little bit deeper, to identify why the problem didn't happen locally.

Starting with quay.io/condaforge/miniforge3:4.11.0-2 (released 2022-02-11) I see the strange download non-existant .conda URLs behavior. The older versions work.

Here is a reduced Dockerfile to demo the problem:

# first non working base image
FROM quay.io/condaforge/miniforge3:4.11.0-2

# last working base image
# FROM quay.io/condaforge/miniforge3:4.11.0-0

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Configure apt and install packages
RUN apt-get update \
    && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
    #
    # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
    && apt-get -y install git iproute2 procps iproute2 lsb-release \
    #
    # cleanup
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog

COPY environment.yml environment.yml

RUN conda install -y mamba
RUN mamba env update -n base -f environment.yml

I will pin the base image and check if the test runs successfully.

I also found an issue that describes the problem that occurs when I use the latest base image: Mamba tries to download non-existant .conda URLs from conda-meta

@rendner rendner force-pushed the pr-45807-fix_broken_docker_image branch from 05e0c6d to 54e7490 Compare February 15, 2022 21:49
@rendner
Copy link
Contributor Author

rendner commented Feb 17, 2022

@mroeschke The PR is ready for review from my side.

@mroeschke mroeschke merged commit 1bd193e into pandas-dev:main Feb 17, 2022
@mroeschke
Copy link
Member

Excellent! Thanks @rendner

@NickCrews
Copy link
Contributor

Thank you @rendner! I was having trouble getting docker to build, but I assumed it was on my end, so just gave up because I didn't want to dig into the weeds. Thank you for doing this, it works now for me!

@rendner
Copy link
Contributor Author

rendner commented Mar 3, 2022

The latest version quay.io/condaforge/miniforge3:4.11.0-4 (released Feb 26, 2022) works again.

This seems to be the commit which temporary solves the problem: conda-forge/miniforge@5429a0f

@mroeschke
We could unpin the version of the base image or wait until it is fully resolved. What do you think?

Note:
After unpinning the base image, users who have the broken image quay.io/condaforge/miniforge3:4.11.0-2 as the latest version locally must delete the image or use build option --pull to be able to build successfully.

@mroeschke
Copy link
Member

Sure. As long as our CI check can replicate a Docker build with an image that works correctly, updating the version should be fine

@rendner rendner deleted the pr-45807-fix_broken_docker_image branch March 4, 2022 06:49
simonjayhawkins pushed a commit to simonjayhawkins/pandas that referenced this pull request Mar 30, 2022
* add "--no-build-isolation" to pip install

* add job "build_docker_dev_environment"

* Trigger Build

* fix wrong group name

* add step "Clean up dangling images"

* pin base image

* add newline at end of file

* always pull the latest version of the base image
@simonjayhawkins simonjayhawkins modified the milestones: 1.5, 1.4.2 Mar 30, 2022
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
* add "--no-build-isolation" to pip install

* add job "build_docker_dev_environment"

* Trigger Build

* fix wrong group name

* add step "Clean up dangling images"

* pin base image

* add newline at end of file

* always pull the latest version of the base image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: ERROR building development env using Docker
6 participants