Flask application deployment error while deploying to Azure web app using local Git

Max Torres 0 Reputation points
2025-02-12T19:07:46.31+00:00

Hello,

I need help to understand the attached error log in Pandas and what possible root cause solution I can employ to fix them.

Thanks,

Max

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,318 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Max Torres 0 Reputation points
    2025-02-12T21:46:43.3933333+00:00

    Sorry I thought I attached it. Here it is.

    Deploy logs errors.txt

    0 comments No comments

  2. Max Torres 0 Reputation points
    2025-02-12T21:47:51.4333333+00:00

  3. Max Torres 0 Reputation points
    2025-02-14T00:37:45.83+00:00

    Just following up on this help needed.

    0 comments No comments

  4. Siva Nair 155 Reputation points Microsoft Vendor
    2025-02-14T04:33:23.2333333+00:00

    Hi Max Torres,

    Welcome to the Microsoft Q&A.

    I understand that you're experiencing deployment error while deploying to Azure web app using local Git.

    Error Log message- "ModuleNotFoundError: No module named distutils" 

    To fix the issue, Lets follow these Points:

    Check requirements.txt for newer, compatible versions of the packages. That way, you will avoid deprecated modules like distutils and have it working with Python 3.12. Most probably, Azure Web Apps does not come with these build tools installed out of the box. You can either add a startup.txt or a startup.sh file that will install them or use a custom Docker image that has the tools pre-installed. These are installation-time packages- numpy and pandas.

    Install the following pre-built wheels: numpy>=1.24.0, pandas>=2.0.0- These versions are available as pre-built wheels and do not need any compilation.. Make sure your local environment is in sync with the Python version used in Azure which is Python 3.12 Add a runtime.txt file to your Azure Web App that contains python-3.12 If all else fails, manually add distutils to your requirements.txt file as well.

    Always use a virtual environment such as 'venv' on your local machine so that you do not end up with issues related to globally installed packages.. Below is an updated examples of requirements.txt: setuptools>=68.0., wheel>=0.40., flask>=2., flask-wtf>=1/0., openai>=1./3., python-docx>=0./8./11., PyPDF2>=3./0/1., pandas≥2./0., numpy >= 1./24./ 

    Note: The error is due to the absence of the 'distutils' module or its inability to locate it within the Azure environment; it falls under the standard library modules of Python. Such tools depend on setuptools for installing packages such as pandas.

    If you have any further assistant, do let me know.

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.