Reputation: 717
I'm encountering a weird warning with azure functions locally.
Whenever I func start
my function, I get these error messages:
Found Python version 3.10.12 (python3).
Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554
[2023-11-14T10:02:39.795Z] Customer packages not in sys path. This should never happen!
[2023-11-14T10:02:42.194Z] Worker process started and initialized.
In the host.json, extensionBundle version is [3.*, 4.0.0)
In the local.settings.json, "FUNCTIONS_WORKER_RUNTIME": "python"
The function app is based on the new model of python azure function (func init MyProjFolder --worker-runtime python --model V2 https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=linux%2Cisolated-process%2Cnode-v4%2Cpython-v2%2Chttp-trigger%2Ccontainer-apps&pivots=programming-language-python)
My first interrogation is the first warning:
Customer packages not in sys path. This should never happen!
. I'm using a virtual environment.
The function is starting correctly, but what is this warning?
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
}
}
Upvotes: 7
Views: 7308
Reputation: 24827
This warning will usually appear when you develop and run azure function locally. If you look at the source code of Python worker for Azure Functions this logging is happening here.
if CUSTOMER_PACKAGES_PATH not in sys.path:
logger.warning("Customer packages not in sys path.")
CUSTOMER_PACKAGES_PATH
is defined as:
CUSTOMER_PACKAGES_PATH = "/home/site/wwwroot/.python_packages/lib/site-packages"
As you can see the path starts with /home/site/wwwroot
which is how the file path looks like post deployment. So, this check is meant to ensure that the paths are configured correctly after the deployment. You can ignore the warning when developing locally.
Upvotes: 10
Reputation: 8694
This seems to be the issue with the latest version of Azure function Core tools (4.0.5455), which is published recently (6 days ago) as mentioned in the official doc.
I have created a python Azure function to check the same:
Python Version: 3.11.5
Azure Functions Core Tools
Core Tools Version: 4.0.5348 Commit hash: N/A (64-bit)
Function Runtime Version: 4.24.5.21262
Updated the Azure function Core tools version to 4.0.5455
.
Running the same Azure Function again with below versions:
Python version 3.11.6 (py).
Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554
Upvotes: 5