Sorry I thought I attached it. Here it is.
Flask application deployment error while deploying to Azure web app using local Git
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
4 answers
Sort by: Most helpful
-
-
Max Torres 0 Reputation points
2025-02-12T21:47:51.4333333+00:00 -
Max Torres 0 Reputation points
2025-02-14T00:37:45.83+00:00 Just following up on this help needed.
-
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.