pythonazureazure-functionsdevopsazure-functions-core-tools

Python Azure Function deployment (Oryx build) hangs on "Running pip install..." step


I am attempting to deploy an Azure Function to production.

Local environment:

Azure environment:

The issue: When deploying from my local environment to Azure, the VS Code output windows shows that the build progresses to the "Running pip install..." step, but no further. It never completes:

11:53:56 PM <function name removed>: Starting deployment...
11:53:56 PM <function name removed>: Creating zip package...
11:54:00 PM <function name removed>: Zip package size: 17.6 MB
11:54:05 PM <function name removed>: Fetching changes.
11:54:06 PM <function name removed>: Cleaning up temp folders from previous zip deployments and extracting pushed zip file <removed>.zip (16.84 MB) to /tmp/zipdeploy/extracted
11:54:09 PM <function name removed>: Updating submodules.
11:54:10 PM <function name removed>: Preparing deployment for commit id <removed>.
11:54:10 PM <function name removed>: PreDeployment: context.CleanOutputPath False
11:54:10 PM <function name removed>: PreDeployment: context.OutputPath /home/site/wwwroot
11:54:10 PM <function name removed>: Repository path is /tmp/zipdeploy/extracted
11:54:10 PM <function name removed>: Running oryx build...
11:54:10 PM <function name removed>: Command: oryx build /tmp/zipdeploy/extracted -o /tmp/build/expressbuild --platform python --platform-version 3.9.7 -i <removed> -p packagedir=.python_packages/lib/site-packages
11:54:11 PM <function name removed>: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
11:54:11 PM <function name removed>: You can report issues at https://github.com/Microsoft/Oryx/issues
11:54:11 PM <function name removed>: Oryx Version: 0.2.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1
11:54:11 PM <function name removed>: Build Operation ID: <removed>
11:54:11 PM <function name removed>: Repository Commit : <removed>
11:54:11 PM <function name removed>: OS Type           : bullseye
11:54:11 PM <function name removed>: Image Type        : githubactions
11:54:11 PM <function name removed>: Detecting platforms...
11:54:12 PM <function name removed>: Detected following platforms:
11:54:12 PM <function name removed>:   python: 3.9.7
11:54:12 PM <function name removed>: Using intermediate directory <removed>.
11:54:12 PM <function name removed>: Copying files to the intermediate directory...
11:54:12 PM <function name removed>: Done in 0 sec(s).
11:54:12 PM <function name removed>: Source directory     : <removed>
11:54:12 PM <function name removed>: Destination directory: /tmp/build/expressbuild
11:54:13 PM <function name removed>: Python Version: /tmp/oryx/platforms/python/3.9.7/bin/python3.9
11:54:13 PM <function name removed>: Creating directory for command manifest file if it does not exist
11:54:13 PM <function name removed>: Removing existing manifest file
11:54:13 PM <function name removed>: Running pip install...

I have confirmed this is the behavior both when deploying to the dev and the prod app in Azure.

Things I have tried with no luck:

Any ideas?


Solution

  • In order to reproduce the steps being carried out by the Azure build locally, I deleted my entire .venv folder, then rebuilt locally. I found this took an inordinately long amount of time and, in researching the errors I saw, came across this post: pip's dependency resolver takes way too long to solve the conflict

    I had not pinned version numbers in my requirements.txt file. Doing this resolved the issue and I was again able to deploy to Azure.