Missing python dependencies in Azure Function App

Jose Fernandez-Alcon 0 Reputation points
2025-05-16T01:02:52.2433333+00:00

We have a python function app that has been working for several months and stopped working complaining about a missing dependency, which is surprising because the function was never redeployed.

The interesting thing is that if we run it locally using the 'func' utility it works, but when deployed it fails.

We have tried multiple options like building locally and remotely, but the function keeps failing when we deploy it.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jason Nguyen 5 Reputation points Independent Advisor
    2025-05-16T06:42:26.15+00:00

    Hi Jose,

    Thank you for contacting Q&A Forum. I would like to provide my findings and proposed solution:

    This kind of problem can happen in Azure Functions due to changes in the underlying environment, even if you haven't redeployed.Azure Functions (especially on the Consumption Plan) can auto-clean or update the environment, which might remove or invalidate dependencies that were previously cached. If the dependency isn’t explicitly listed in your requirements.txt, it might have been available in the environment before but is now missing. Your local environment might be using a different Python version than the one configured in Azure (e.g., Python 3.10 locally vs. 3.9 in Azure).If you're using zip deployment or GitHub Actions, the venv folder might be excluded, and Azure is expected to install dependencies from requirements.txt.Try deploying to a new Function App to see if the issue persists. This can help isolate whether the problem is with the app or the environment.

    Kindly let me know if this work for you and please let me know if you have any further question.

    Best regards

    0 comments No comments

  2. Ranashekar Guda 2,670 Reputation points Microsoft External Staff Moderator
    2025-05-16T19:24:42.34+00:00

    Hello @Jose Fernandez-Alcon,
    As suggested by @John Le, Based on the information you provided, here are a few things you can check to troubleshoot the issue. It appears your Azure Function App is encountering issues with missing Python dependencies after deployment. This can result from several factors, such as OS mismatches, incorrect deployment setup, or changes in the Azure environment.

    Ensure you're deploying using an Ubuntu-based environment, as some dependencies may not install correctly on other systems. Verify that your pip install command targets the correct (case-sensitive) subfolder if your function app is structured that way, and that files are properly deployed to /home/site/wwwroot.

    If publishing manually, set both SCM_DO_BUILD_DURING_DEPLOYMENT and ENABLE_ORYX_BUILD to true to ensure proper build and dependency installation. Use the func azure functionapp publish <app-name> --build-native-deps command for functions with native dependencies.

    Also, confirm that your Python version in Azure (3.7–3.9) matches your local environment, and use a clean, accurate requirements.txt file. Reviewing logs in the Azure portal and using the latest Azure Function Core Tools can help diagnose and resolve missing package issues.
    Kindly refer below link:
    Troubleshoot Python errors in Azure Functions
    Bring dependencies or third party library to Azure Functions

    Hope this helps. Do let us know if you any further queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.