Taragolis commented on issue #39967:
URL: https://github.com/apache/airflow/issues/39967#issuecomment-2141807330

   `numpy==1.26.4` definitely greater than `>=1.16.6`, more like something 
wrong with your `pip`
   
   ---
   
   Unable to reproduce with [extending Airflow 
Image](https://airflow.apache.org/docs/docker-stack/build.html#extending-the-image)
   
   ```dockerfile
   ARG AIRFLOW_TARGET_VERSION="2.9.1"
   ARG PYTHON_TARGET_VERSION="3.9"
   
   FROM apache/airflow:${AIRFLOW_TARGET_VERSION}-python${PYTHON_TARGET_VERSION}
   ARG AIRFLOW_TARGET_VERSION
   ARG PYTHON_TARGET_VERSION
   
   USER root
   
   RUN apt-get update \
       && apt-get install -y --no-install-recommends \
           build-essential
   
   USER airflow
   
   RUN pip install 
"apache-airflow[async,celery,cncf.kubernetes,databricks,dbt.cloud,http,ssh,statsd,jdbc,password,postgres,redis,s3,slack,sentry,google-auth,amazon]==${AIRFLOW_TARGET_VERSION}"
 --constraint 
"https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_TARGET_VERSION}/constraints-${PYTHON_TARGET_VERSION}.txt";
   ```
   
   ```console
   ❯ docker build . -t custom-airflow:bar
   
   [+] Building 108.0s (7/7) FINISHED                                           
                                                                     
docker:desktop-linux
    => [internal] load build definition from Dockerfile                         
                                                                                
     0.0s
    => => transferring dockerfile: 695B                                         
                                                                                
     0.0s
    => [internal] load metadata for docker.io/apache/airflow:2.9.1-python3.9    
                                                                                
     0.0s
    => [internal] load .dockerignore                                            
                                                                                
     0.0s
    => => transferring context: 2B                                              
                                                                                
     0.0s
    => CACHED [1/3] FROM docker.io/apache/airflow:2.9.1-python3.9               
                                                                                
     0.0s
    => [2/3] RUN apt-get update     && apt-get install -y 
--no-install-recommends         build-essential                                 
                          34.6s
    => [3/3] RUN pip install 
"apache-airflow[async,celery,cncf.kubernetes,databricks,dbt.cloud,http,ssh,statsd,jdbc,password,postgres,redis,s3,slack,sentry,google
  72.3s 
    => exporting to image                                                       
                                                                                
     1.0s 
    => => exporting layers                                                      
                                                                                
     1.0s 
    => => writing image 
sha256:604e62ce6a630dd6c7f9fc6d21bcf4a18cda3030def3d81a9fc3308bb7b3bd8a         
                                                             0.0s 
    => => naming to docker.io/library/custom-airflow:bar                        
   
   ```
   
   As well as build [custom Airflow 
image](https://airflow.apache.org/docs/docker-stack/build.html#customizing-the-image)
   
   ```console
   ❯ git checkout 2.9.1
   HEAD is now at 2d53c1089f Update RELEASE_NOTES.rst
   
   ❯ export AIRFLOW_VERSION=2.9.1
   ❯ export PYTHON_VERSION=3.9
   ❯ export DOCKER_BUILDKIT=1
   
   ❯ docker build . \
       --pull \
       --build-arg INSTALL_MYSQL_CLIENT="true" \
       --build-arg INSTALL_POSTGRES_CLIENT="true" \
       --build-arg PYTHON_BASE_IMAGE="python:${PYTHON_VERSION}-slim-bookworm" \
       --build-arg AIRFLOW_VERSION="${AIRFLOW_VERSION}" \
       --build-arg 
ADDITIONAL_AIRFLOW_EXTRAS="async,celery,cncf.kubernetes,databricks,dbt.cloud,http,ssh,statsd,jdbc,password,postgres,redis,s3,slack,sentry,google-auth,amazon"
 \
       --tag "custom-airflow:${AIRFLOW_VERSION}-${PYTHON_VERSION}"
   [+] Building 574.1s (73/73) FINISHED                                         
                                                                     
docker:desktop-linux
    => [internal] load build definition from Dockerfile                         
                                                                                
     0.0s
    => => transferring dockerfile: 73.90kB                                      
                                                                                
     0.0s
    => resolve image config for docker-image://docker.io/docker/dockerfile:1.4  
                                                                                
     0.6s
    => CACHED 
docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc
                                 0.0s
    => [internal] load .dockerignore                                            
                                                                                
     0.0s
    => => transferring context: 3.05kB                                          
                                                                                
     0.0s
    => [internal] load metadata for docker.io/library/python:3.9-slim-bookworm  
                                                                                
     2.3s
    => [internal] preparing inline document                                     
                                                                                
     0.0s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => [internal] preparing inline document                                     
                                                                                
     0.1s
    => [internal] preparing inline document                                     
                                                                                
     0.1s
    => [internal] settings cache mount permissions                              
                                                                                
     0.1s
    => [internal] preparing inline document                                     
                                                                                
     0.1s
    => [internal] preparing inline document                                     
                                                                                
     0.1s
    => [internal] preparing inline document                                     
                                                                                
     0.1s
    => [internal] preparing inline document                                     
                                                                                
     0.0s
    => [internal] preparing inline document                                     
                                                                                
     0.1s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => [internal] load build context                                            
                                                                                
     1.1s
    => => transferring context: 73.90kB                                         
                                                                                
     1.0s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => [airflow-build-image  1/16] FROM 
docker.io/library/python:3.9-slim-bookworm@sha256:088d9217202188598aac37f8db0929345e124a82134ac66b8bb50ee9750b045b
           5.4s
    => => resolve 
docker.io/library/python:3.9-slim-bookworm@sha256:088d9217202188598aac37f8db0929345e124a82134ac66b8bb50ee9750b045b
                                 0.0s
    => => 
sha256:997301717bfef8b7a6492497c718abafaecce275fc136bee14330d0bd3bac5bc 1.37kB 
/ 1.37kB                                                                    0.0s
    => => 
sha256:182cc99a2af6b2eb20b8da7e1a0d3661424b8fa7a0f0fbdac147e5e4ca8a3005 6.92kB 
/ 6.92kB                                                                    0.0s
    => => 
sha256:cdae7fc163d4847b02fda781be1d1ea6709ec2362c85cce3030f42700d9b4421 11.86MB 
/ 11.86MB                                                                  4.7s
    => => 
sha256:cb40e615cf984523026eeff4eac99f566238cb142ee4d65c10716886848eb3b0 244B / 
244B                                                                        0.7s
    => => 
sha256:06ff06197436dd9492603aa96e1d4e1510c4eec06c0a06508fc845f3f8f328ea 3.13MB 
/ 3.13MB                                                                    2.1s
    => => 
sha256:088d9217202188598aac37f8db0929345e124a82134ac66b8bb50ee9750b045b 1.86kB 
/ 1.86kB                                                                    0.0s
    => => extracting 
sha256:cdae7fc163d4847b02fda781be1d1ea6709ec2362c85cce3030f42700d9b4421         
                                                                0.5s
    => => extracting 
sha256:cb40e615cf984523026eeff4eac99f566238cb142ee4d65c10716886848eb3b0         
                                                                0.0s
    => => extracting 
sha256:06ff06197436dd9492603aa96e1d4e1510c4eec06c0a06508fc845f3f8f328ea         
                                                                0.2s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => CACHED [internal] preparing inline document                              
                                                                                
     0.0s
    => [scripts  1/17] COPY <<EOF /install_os_dependencies.sh                   
                                                                                
     0.0s
    => [scripts  2/17] COPY <<EOF /install_mysql.sh                             
                                                                                
     0.0s
    => [scripts  3/17] COPY <<EOF /install_mssql.sh                             
                                                                                
     0.0s
    => [scripts  4/17] COPY <<EOF /install_postgres.sh                          
                                                                                
     0.0s
    => [scripts  5/17] COPY <<EOF /install_packaging_tools.sh                   
                                                                                
     0.0s
    => [scripts  6/17] COPY <<EOF 
/install_airflow_dependencies_from_branch_tip.sh                                
                                                   0.0s
    => [scripts  7/17] COPY <<EOF /common.sh                                    
                                                                                
     0.0s
    => [scripts  8/17] COPY <<EOF /pip                                          
                                                                                
     0.0s
    => [scripts  9/17] COPY <<EOF /install_from_docker_context_files.sh         
                                                                                
     0.0s
    => [scripts 10/17] COPY <<EOF /get_package_specs.py                         
                                                                                
     0.0s
    => [scripts 11/17] COPY <<EOF /install_airflow.sh                           
                                                                                
     0.0s
    => [scripts 12/17] COPY <<EOF /install_additional_dependencies.sh           
                                                                                
     0.0s
    => [scripts 13/17] COPY <<EOF /create_prod_venv.sh                          
                                                                                
     0.0s
    => [scripts 14/17] COPY <<EOF /create_prod_venv.sh                          
                                                                                
     0.0s
    => [scripts 15/17] COPY <<EOF /entrypoint_prod.sh                           
                                                                                
     0.0s
    => [scripts 16/17] COPY <<EOF /clean-logs.sh                                
                                                                                
     0.0s
    => [scripts 17/17] COPY <<EOF /airflow-scheduler-autorestart.sh             
                                                                                
     0.0s
    => [airflow-build-image  2/16] COPY --from=scripts 
install_os_dependencies.sh /scripts/docker/                                     
                              0.1s
    => [airflow-build-image  3/16] RUN bash 
/scripts/docker/install_os_dependencies.sh dev                                  
                                       124.8s
    => [main  3/18] RUN bash /scripts/docker/install_os_dependencies.sh runtime 
                                                                                
    48.9s
    => [main  4/18] COPY --from=scripts common.sh /scripts/docker/              
                                                                                
     0.0s
    => [main  5/18] COPY --from=scripts install_mysql.sh install_mssql.sh 
install_postgres.sh /scripts/docker/                                            
           0.0s
    => [main  6/18] RUN bash /scripts/docker/install_mysql.sh prod     && bash 
/scripts/docker/install_mssql.sh prod     && bash 
/scripts/docker/install_postgres.  36.2s
    => [airflow-build-image  4/16] COPY --from=scripts common.sh 
/scripts/docker/                                                                
                    0.0s
    => [airflow-build-image  5/16] COPY --from=scripts install_mysql.sh 
install_mssql.sh install_postgres.sh /scripts/docker/                           
             0.1s
    => [airflow-build-image  6/16] RUN bash /scripts/docker/install_mysql.sh 
dev &&     bash /scripts/docker/install_mssql.sh dev &&     bash 
/scripts/docker/inst  22.6s
    => [airflow-build-image  7/16] RUN adduser --gecos "First 
Last,RoomNumber,WorkPhone,HomePhone" --disabled-password        --quiet 
"airflow" --uid "50000" --gid  0.2s
    => [airflow-build-image  8/16] COPY --chown=50000:0 Dockerfile 
/docker-context-files                                                           
                  0.0s
    => [airflow-build-image  9/16] RUN if [[ -f /docker-context-files/pip.conf 
]]; then         mkdir -p /home/airflow/.config/pip;         cp 
/docker-context-file  0.1s
    => [airflow-build-image 10/16] COPY --from=scripts common.sh 
install_packaging_tools.sh      install_airflow_dependencies_from_branch_tip.sh 
create_prod_venv.s  0.1s
    => [airflow-build-image 11/16] RUN bash 
/scripts/docker/install_packaging_tools.sh;     bash 
/scripts/docker/create_prod_venv.sh;     if [[ false == "true" &&  16.0s
    => [airflow-build-image 12/16] COPY --chown=airflow:0 Dockerfile 
/Dockerfile                                                                     
                0.0s
    => [airflow-build-image 13/16] WORKDIR /opt/airflow                         
                                                                                
     0.0s
    => [airflow-build-image 14/16] COPY --from=scripts 
install_from_docker_context_files.sh install_airflow.sh      
install_additional_dependencies.sh create_prod_  0.0s
    => [airflow-build-image 15/16] RUN 
--mount=type=cache,id=python:3.9-slim-bookworm-24.0-arm64-9,target=/tmp/.cache/pip,uid=50000
     if [[ false == "true" ]];  385.1s
    => [airflow-build-image 16/16] RUN 
--mount=type=cache,id=additional-requirements-python:3.9-slim-bookworm-24.0-arm64-9,target=/tmp/.cache/pip,uid=50000
     if   0.2s
    => [main  7/18] COPY --from=airflow-build-image --chown=airflow:0      
/home/airflow/.local /home/airflow/.local                                       
          6.9s
    => [main  8/18] COPY --from=airflow-build-image --chown=airflow:0      
/home/airflow/constraints.txt /home/airflow/constraints.txt                     
          0.0s
    => [main  9/18] COPY --from=airflow-build-image --chown=airflow:0 
/Dockerfile /Dockerfile                                                         
               0.0s
    => [main 10/18] COPY --from=scripts entrypoint_prod.sh /entrypoint          
                                                                                
     0.0s
    => [main 11/18] COPY --from=scripts clean-logs.sh /clean-logs               
                                                                                
     0.0s
    => [main 12/18] COPY --from=scripts airflow-scheduler-autorestart.sh 
/airflow-scheduler-autorestart                                                  
            0.0s
    => [main 13/18] RUN chmod a+rx /entrypoint /clean-logs     && chmod g=u 
/etc/passwd     && chmod g+w "/home/airflow/.local"     && usermod -g 0 airflow 
-G 0     0.3s
    => [main 14/18] RUN sed --in-place=.bak 
"s/secure_path="/secure_path="$(echo -n /home/airflow |         sed 
's/\//\\//g')\/.local\/bin:/" /etc/sudoers           0.2s
    => [main 15/18] RUN mkdir -pv /root/bin                                     
                                                                                
     0.2s
    => [main 16/18] COPY --from=scripts pip /root/bin/pip                       
                                                                                
     0.0s
    => [main 17/18] RUN chmod u+x /root/bin/pip                                 
                                                                                
     0.2s
    => [main 18/18] WORKDIR /opt/airflow                                        
                                                                                
     0.0s
    => exporting to image                                                       
                                                                                
     5.0s
    => => exporting layers                                                      
                                                                                
     5.0s
    => => writing image 
sha256:922e028990ee23c6c08d2bd5a7ff8f14535bd72c707915c1e9f988884c96bd58         
                                                             0.0s
    => => naming to docker.io/library/custom-airflow:2.9.1-3.9
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to