I am unable to make successful deployment of Azure Function when I require torch for my service. Earlier, I could deploy if I comment-out torch from requirements.txt file, which is explained after the following Update section:
UPDATE: I partially solved it. The problem is with dependencies listed in requirements.txt file. I am using spacy and downloading 'en_core_web_sm' model. So I added following line in requirements.txt file and it was able to load en_core_web_sm as well:
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1.tar.gz
Now, the basic functionality is working. But for one of a service I need torch. If I comment-out this service and torch from requirements.txt file, then the deployment is successful and I can access endpoints. As soon as I try to install torch, I get deployment failed with error in Output:

I am installing torch by having this line in requirements.txt file:
torch==2.2.0 --index-url https://download.pytorch.org/whl/cpu
Question now: Does it have to do with size of torch package? (I am running function in an Azure App Service Plan with Pricing plan = Y1)
My app looks like this (one function shown here1) in function_app.py file:
@app.function_name(name='Tokenizer')
@app.route(route='tokenization')
def tokenization(req: func.HttpRequest) -> func.HttpResponse:
if req.method=='POST':
logging.info("Processing POST Request ... ")
return _post_handler_tokenization(req)
elif req.method == 'GET':
logging.info("Processing GET Request ... ")
return _get_handler_tokenization(req)
return func.HttpResponse('[INFO] Service isnt ready', mimetype='text/plain', status_code=200)
I am able to send and get HTTP req/res locally as shown below:

====NOTE====: The problem below was solved by commenting out torch (as discussed above) and providing correct spacy dependency in requirements.txt file!
Now when I try to deploy this function to Azure Function App, I am able to deploy it but the function doesn't apear on Azure, as shown below:
I restarted the Azure Function and tried again the deployment but the function is not accessible. In the output section I saw logs and I sense a problem. I was expecting it would detect http trigger URLs as I saw on sample azure function deployment, but I see this:
And I also tried to do deployment via terminal using this command:
func azure functionapp publish <Azure_Function_App_Name> --build remote
And the result on terminal was this:
But the function doesn't show up on Azure Function App. Can anyone help me where I am going wrong? Thanks



