Reputation: 603
I have a Python Azure function which executes locally. It is deployed to Azure and I selected the 'free app plan'. The Python has dependencies on various modules, such as requests
. The modules are not loaded into the app like they are locally on my machine. The function fails when triggered.
I have tried installing the dependencies using Kudu console from my site, this hangs with message cleaning up >> every time.
I have tried installing the dependencies using SSH terminal from my site, the installations succeed but i cannot see the modules when python pip list
in kudo and the app still fails. I cannot navigate the directories ls
does nothing.
I tried to install extensions using the portal but this option is greyed out in development-tools.
Upvotes: 1
Views: 2101
Reputation: 779
I know this is old, but am adding answer for those who come later (and because I have been fighting with this myself and cannot find answers anywhere). Let's face it, there are times when local development is not an option for one reason or another, so the local development docs are not helpful. This thread provided the last pieces I needed to solve the problem for a linux Function App.
NOTE -- this does not work with consumption plans
Simple -- once you have the secret sauce! Why Microsoft can't document this is beyond me.
Upvotes: 0
Reputation: 14088
You can find a requirements.txt in your local function folder.
If you want function on azure to install the 'requests', your requirements.txt should be like this:(Azure will install the extension based on this file)
azure-functions
requests
And all these packages will be packaged into a new package on Azure, so you can not display which packages using pip list
. Also, please keep in mind that Linux's Kudu feature is limited and you cannot install packages through it.
Problem seems comes from VS Code, you can use command to deploy your function app.
For example, my functionapp on Azure named 423PythonBowman2, So this is my command:
func azure functionapp publish 423PythonBowman --build remote
I quoted requests in the code, and with cmd deploy my function can works fine on portal with no errors.
Have a look of the offcial doc:
Upvotes: 2