How to resolve issue with Azure Web App deployment not recognizing requirements.txt?

Tyler Suard 55 Reputation points

I am using this repo:

The repo includes a requirements.txt. I added an extra package to requirements.txt, pymongo.

When I deploy my app to a WebApp using the Azure extension in VSCode, the deployment fails, because pymongo was not installed.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
761 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 15,171 Reputation points Microsoft Employee

    @Tyler Suard

    1. Make sure that the requirements.txt file is in the root directory of your project. If it is not in the root directory, the deployment process may not be able to find it.
    2. Check that the requirements.txt file is properly formatted. Each package should be listed on a separate line, and the package name and version should be separated by ==. For example:
    3. Check that the pymongo package is spelled correctly in the requirements.txt file. If there is a typo in the package name, the deployment process will not be able to find it.
    4. If you have made changes to the requirements.txt file after the initial deployment, make sure to redeploy the app. The deployment process will only install the packages listed in the requirements.txt file at the time of deployment.
    5. If none of the above steps work, you can try manually installing the pymongo package on the Azure Web App. To do this, you can SSH into the Web App and run the following command:
         pip install pymongo
      This will install the pymongo package on the Web App, and your app should be able to use it.

    If the above suggestions do not work, reply to this message so we can assist you further.

    0 comments No comments