Python Webapp on Azure - PyTorch

SuperMX 6 Reputation points
2021-07-27T15:41:24.57+00:00

Hello!

I have a python web app on Azure.
How can I install torch with requirements.txt?

With the Web SSH, it always restarts.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,793 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Saravanan Sivaraj 6 Reputation points
    2022-05-20T10:39:11.27+00:00

    Try adding this to the requirements file. It worked for me.

    -f https://download.pytorch.org/whl/torch_stable.html
    torch==1.11.0+cpu
    torchvision==0.12.0+cpu

    1 person found this answer helpful.

  2. Ryan Hill 25,471 Reputation points Microsoft Employee
    2021-07-27T21:47:47.12+00:00

    Hi @SuperMX ,

    When you deploy your Python app, Azure App Service will create a virtual environment to and run pip install -r requirements.txt. If you don't see this happening, make sure SCM_DO_BUILD_DURING_DEPLOYMENT is set to 1. See https://learn.microsoft.com/en-us/azure/app-service/configure-language-python for more details. If you're seeing errors during app startup, please comment down below.