Deep Learning Python package installation fails in Function app

Rajamannar A K 86 Reputation points
2021-12-03T17:38:15.777+00:00

I'm trying to create a function app with HTTP trigger, While deploying from VS code to function app the deployment fails because of the following packages

torch
torchvision
allennlp
allennlp-models

(I'm using the VS Code editors deploy option to create a deployment)
Runtime stack which I'm using is 3.9 and func core tools is v4.0(tried using v3.0 as well still faced the same error)

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,016 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,401 Reputation points
    2021-12-06T08:24:45.71+00:00

    @Rajamannar A K ,

    Thanks for reaching out to Q&A.

    When developing locally using the Azure Functions Core Tools or Visual Studio Code, add the names and versions of the required packages to the requirements.txt file and install them using pip.
    Reference : https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=azurecli-linux%2Capplication-level#package-management

    If you have properly done the above steps and if it still doesnt work. Please explore the below steps

    1. Do a remote build when you are deploying from VS code to Azure via the func command. Generally, if your Azure Functions Core tools are updated to the latest version, it should ideally perform a remote build. Please check the below articles for more details: https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-technologies#remote-build
    2. Alternatively, consider using Docker to deploy the app in order to bypass the Zip deploy size limit. For more information on Deployment technologies available in Azure Functions, check this great article: https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-technologies

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.