I’m trying to run my azure functions locally (using Postman) for testing. To do this I am accessing via command line (cmd) and run "func start".
Once I run this function in my azure function folder, the command line gives me a huge error that I can’t paste into this question because it’s so big, but I know it’s attributed to Python modules .
After that error, the cmd still gives me a list of azure functions. To better understand my problem, I leave here a set of images.
I have already reviewed the requirement.txt and there are all the libraries that should be installed. I also checked that these libraries were installed on my PC and in the .venv that is created for the azure functions.
Here I leave a copy of my requirement.txt (I must also mention that I already uninstalled and installed the requirements)
azure-functions == 1.13.3
chardet == 5.1.0
azure-storage-blob == 12.15.0
pandas == 1.5.3
pyodbc == 4.0.34
SQLAlchemy == 1.4.39
statsmodels == 0.13.2
datetime == 5.1
numpy == 1.21.5
adal == 1.2.7
requests == 2.28.1
cchardet == 2.1.7
Office365-REST-Python-Client == 2.3.16
openpyxl == 3.0.10
I hope someone can give me a clue as to what mistake I may be making.
Greetings and thanks!
2
Answers
In my experience, this error usually show up when the python version defined in the functionapp isn’t the same as the version you’re running locally.
Make sure that the versions, locally (3.9) and the functionapp, are the same.
I tried running the below Azure function and got results as below:-
My requirements.txt
My init.py
When I ran my function app by Pressing F5 key or fn + F5 key or
func host start
.The Function app ran like below, installed the packages and triggered HTTP Request.
Browser:-
If the above method does not work, Try to install your packages by using pip install in your terminal and then run the Function app again:-
Code:-
Output:-
In your virtual environment (venv) check if the packages are installed like below:-
I tried running the Function app in Python Version 3.11 as well as 3.10 and it triggered successfully.
Reference:-
Pandas import causing problems with Azure Function – Microsoft Q&A