Issue in taking the build of an docker image using azure-storage-blob package in arm32v7 architecture

Neeraj Poothottu Sajeevan(UST,IN) 30 Reputation points
2024-02-22T11:15:31.82+00:00

When attempting to build a Dockerfile targeting the arm32v7 architecture, a peculiar error related to gcc arises. Specifically, the error message "unable to execute 'gcc': No such file or directory" emerges during the inclusion of the azure-storage-blob package version 12.6.0 in the requirements file. Surprisingly, excluding this package resolves the issue, enabling the Dockerfile to proceed without hindrance. Notably, other specified packages such as azure-iot-device, pytz, sympy, and python-dateutil remain unaffected by this adjustment. Here are the package versions specified in the requirements file: azure-storage-blob: 12.6.0 azure-iot-device: ~=2.7.0 pytz: 2023.3.post1 sympy: 1.10.1 python-dateutil: 2.8.2 Below is the Dockerfile (Dockerfile.arm32v7) snippet where the error occurs:dockerfile.txt Please provide help to solve this problem

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
535 questions
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 13,456 Reputation points
    2024-02-23T01:53:39.47+00:00

    Hi @Neeraj Poothottu Sajeevan(UST,IN) and @Athira Gopinath(UST,IN) thank you for posting this question on this forum. Firstly. I would like to point out that the latest version of azure-storage-blob library is 12.19.0. Please refer the release-history of the package for reference. Please try to use the latest versions of the library as the new versions potentially has the latest fixes for any issues identified. The error message "unable to execute 'gcc': No such file or directory" suggests that the gcc compiler is missing in the Docker image. This is required by some Python packages which needs to compile some C extensions during installation. The behavior you are encountering indicates the azure-storage-blob library might need it. To fix this issue, you can install the build-essential package in the Docker image, which includes the gcc compiler and other necessary tools for building C extensions. You can add the following command to your Dockerfile before running pip install:

    # Use the official Python image for ARM32v7 as the base image
    FROM arm32v7/python:3.7-slim-buster
    
    # Set the working directory in the container
    WORKDIR /app
    
    # Install required packages 
    RUN apk add --no-cache gcc musl-dev libffi-dev openssl-dev cargo
    
    # Copy the Python application code and requirements.txt into the container
    COPY requirements.txt /app/
    COPY . .
    
    
    # Run
    RUN pip install --no-cache-dir -r requirements.txt
    
    # Command to run the application
    CMD [ "python3", "-u", "./main.py" ]
    

    I appreciate it if you can give this a try and let us know if this helped resolve the issue.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Neeraj Poothottu Sajeevan(UST,IN) 30 Reputation points
    2024-03-14T05:13:38.88+00:00

    Hi @LeelaRajeshSayana-MSFT @Athira Gopinath(UST,IN), With the assistance of Microsoft, we have successfully resolved the issue. The root cause of the problem was identified to be related to specific dependencies of azure-storage-blob. Consequently, we have made revisions to the Dockerfile to address all dependency issues. Please find the updated dockerfile. Thank uou all for the support.

    # Use the official Alpine-based Python image for ARM32v7 as the base image
    FROM arm32v7/python:3.7-alpine
    
    # Set the working directory in the container
    WORKDIR /app 
    
    # Install required packages
    RUN apk add --no-cache gcc musl-dev libffi-dev openssl-dev cargo
    
    # Copy the Python application code and requirements.txt into the container
    COPY requirements.txt /app/
    COPY . .
    
    
    # Upgrade pip
    RUN pip install --no-cache-dir --upgrade pip
    
    
    # Install Python dependencies
    RUN pip install --no-cache-dir -r requirements.txt
    
    # Command to run the application
    CMD [ "python3", "-u", "./main.py" ]
    
    2 people found this answer helpful.