Hi,
I am using azure app service to deploy a flask app via Azure DevOps pipelines with a YAML for CI/CD.
It works locally, however, when I try to import anything it produces the following error in the logs -
2024-12-03T09:35:10.194186052Z import pandas as pd
2024-12-03T09:35:10.194188637Z ModuleNotFoundError: No module named 'pandas'
2024-12-03T09:35:17.251Z ERROR - Container australis-energy-dev-services-app_0_682141a1 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.``
Here's my app.py -
from flask import Flask
import pandas as pd
# Create a Flask application instance
app = Flask(__name__)
# Define a simple route
@app.route("/")
def home():
return "Hello, Flask!"
# Ensure the script runs only if executed directly
if __name__ == "__main__":
# Run the Flask development server
app.run(debug=True, host="0.0.0.0", port=5000)
As shown, its a simple app, as soon as I comment out the pandas import, it works.
I have included pandas with a version compatible with python 3.11 in my requirements.txt and I get the same problem whenever I try to import any other package like numpy, pymssql, pyodbc etc.
My YAML includes code to install requirements.txt and my CI azure devops pipeline corretly installs based on its logs -
Installing collected packages: pytz, pymssql, azure-functions, Werkzeug, urllib3, tzdata, typing_extensions, six, numpy, MarkupSafe, itsdangerous, isodate, idna, gunicorn, click, charset-normalizer, certifi, requests, python-dateutil, Jinja2, pandas, Flask, azure-core, azure-servicebus
Successfully installed Flask-2.1.2 Jinja2-3.1.4 MarkupSafe-3.0.2 Werkzeug-2.1.2 azure-core-1.31.0 azure-functions-1.21.3 azure-servicebus-7.12.3 certifi-2024.8.30 charset-normalizer-3.4.0 click-8.1.7 gunicorn-20.1.0 idna-3.10 isodate-0.7.2 itsdangerous-2.2.0 numpy-1.26.4 pandas-2.1.3 pymssql-2.3.2 python-dateutil-2.9.0.post0 pytz-2024.2 requests-2.32.3 six-1.16.0 typing_extensions-4.12.2 tzdata-2024.2 urllib3-2.2.3
Finishing: Install dependencies