I was publishing an Azure Function with Azure DevOps vs. deploying with VS Code and was finding the function was failing because the .python_packages folder was missing. Reviewing the build code the standard python package was populated with “pip install -r requirements.txt”, which was working on my local client to ensure the published environment included the necessary packages.
I then found that this is due to the template in Azure DevOps being out of date with worker_verv being unsupported.
The correct PIP and requirements section now looks like this:
- script: |
python -m pip install --upgrade pip
pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt
displayName: 'Install dependencies'
For the whole deployment example, check this out.