Azure function WEBSITE_RUN_FROM_PACKAGE Error 500

Simon Elliott 1 Reputation point
2020-06-23T07:50:38.66+00:00

Hi

I have created a python Azure Function. It works fine when deployed from VS Code. However when I deploy it using Azure Devops it doesn't sadly.

The reason it doesn't work is because the packages my python code require won't import (Module Not Found). The deployed zip package I can see (and download) when I look at my functions WEBSITE_RUN_FROM_PACKAGE Setting definitely has the packages my code needs inside it (in the worker_venv directory). My only guess is that this worker_venv virtual environment has not been activated before the function is run.

My function is the simplest hello world type python function the wizard creates with the addition of one "import numpy" line. I have added numpy to my requirements.txt. I have followed what I believe to be the happy "point and click" path for deploying Azure Function devops pipelines. The only thing I changed was python3.6 to 3.7. Everything in my devops pipeline and release deployment is green. But the azure function errors 500 with ModuleNotFound for numpy.

I have run out of things to try. Any help would be gratefully received.

Simon

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

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 69,756 Reputation points
    2020-06-29T09:47:01.38+00:00

    Welcome to Microsoft Q&A! Thanks for posting the issue.

    Apologies for any inconvenience with this issue. We no longer support worker_venv in Python 3.7, instead, we will use the ./.python_packages/lib/site-packages folder to store the Python modules

    Can you build your app following this - https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?tabs=python.
    Reference: https://github.com/Azure/azure-functions-python-worker/issues/590

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

    1 person found this answer helpful.