Azure Function Kudu not recognizing pip

Miguel Andreu 25 Reputation points
2024-11-11T13:15:06.36+00:00

Hello.

I have 2 exactly same Azure Functions in different resource groups, Infrastructure team has verified and networking and connections are the same.

In one of the Azure Function, my requirements indicated in requirements.txt file are properly installed, in the other, they are not and Kudu is blocking my deployment.

Deployment method is being done through VS Code.

I'm having the following logs:

Command: oryx build /tmp/zipdeploy/extracted -o /tmp/build/expressbuild --platform python --platform-version 3.11 -i /tmp/8dcfcdd6cd18249 -p packagedir=.python_packages/lib/site-packages
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20240424.1, Commit: d37b2225a252ab2c04b4726024d047cf01ea1318, ReleaseTagName: 20240424.1

Build Operation ID: 125377828ccd59f4
Repository Commit : 7b55bc72-c05b-4bf8-97f6-3ac2ccfd7861
OS Type           : bullseye
Image Type        : githubactions

Detecting platforms...
Detected following platforms:
  python: 3.11.10
Version '3.11.10' of platform 'python' is not installed. Generating script to install it...

Using intermediate directory '/tmp/8dcfcdd6cd18249'.

Copying files to the intermediate directory...
Done in 0 sec(s).

Source directory     : /tmp/8dcfcdd6cd18249
Destination directory: /tmp/build/expressbuild


Downloading and extracting 'python' version '3.11.10' to '/tmp/oryx/platforms/python/3.11.10'...
Detected image debian flavor: bullseye.
Downloaded in 2 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: python...
Done in 7 sec(s).

image detector file exists, platform is python..
OS detector file exists, OS is bullseye..
Python Version: /tmp/oryx/platforms/python/3.11.10/bin/python3.11
Creating directory for command manifest file if it does not exist
Removing existing manifest file

Running pip install...
Done in 389 sec(s).
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8f94c90>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8f941d0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8f97e90>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8fa0690>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8fa0ed0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
ERROR: Could not find a version that satisfies the requirement azure-functions (from versions: none)
ERROR: No matching distribution found for azure-functions
"2024-11-04 14:38:32"|ERROR|WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8f94c90>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8f941d0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8f97e90>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8fa0690>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7c0dc8fa0ed0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/azure-functions/
ERROR: Could not find a version that satisfies the requirement azure-functions (from versions: none)
ERROR: No matching distribution found for azure-functions | Exit code: 1 | Please review your requirements.txt | More information: https://aka.ms/troubleshoot-python
\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /tmp/build/expressbuild --platform python --platform-version 3.11 -i /tmp/8dcfcdd6cd18249 -p packagedir=.python_packages/lib/site-packages

I have tried to install them in Kudu and most of the times I'm not able to get internet connectivity, just once I could install them but automatic deployment is not working.

I have tried with several libraries, and setups, defining fixed versions, including all my libraries, only the required,...

Libraries that are currently on requirements.txt are:

azure-functions
pyodbc
azure-identity

Thanks in advance

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,929 questions
0 comments No comments
{count} vote

Accepted answer
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2024-11-11T15:18:10.4866667+00:00

    Hi @Miguel Andreu

    In looking at the logs, I would put the finger at your function app not being able to pull packages from public sources. You can open the Kudu console and curl into pypi.org for any of the packages in your requirements.txt file. I believe something is blocking this outbound traffic on your function.

    Things to check are Site access and rules for any access restrictions and any NSGs that are defined for a VNET that the function app may be integrated with.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.