Azure Function Published with Azure DevOps is missing .python_packages

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.

Good luck!

Nathan Lasnoski

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s