Azure Function stuck using Python 3.9 despite configuring for Python 3.11 in runtime.txt and settings

BTCElectrician 0 Reputation points
2024-09-19T12:47:55.3666667+00:00

I’ve been trying to run an Azure Function using Python 3.11, but no matter what I do, the logs indicate that the function is running Python 3.9. I’ve gone through multiple deployment attempts and configurations but can’t seem to resolve this.

  1. I’m deploying my function as a ZIP package. I’ve confirmed that the runtime.txt is included and correctly set to python-3.11.
  2. I used unzip -l to confirm the structure of the ZIP file, and the runtime.txt is at the root level with the correct Python version specified.
  3. have set FUNCTIONS_WORKER_RUNTIME to python in the Azure Function App’s Configuration settings.
  4. I’ve checked the App Service Plan and confirmed it’s a Linux-based Consumption Plan (Y1), which supports Python 3.11.
  5. I’ve redeployed the function multiple times, each time ensuring the configuration and deployment package is correct.
  6. And Yes, I've checked my requirements.txt as well and made sure it was included in the my zip folder.

I don't know what else I could be doing wrong. Python is 3.11 on my local, on the portal, its everywhere, but where I need it. When I run a test curl via the portal I always a sudden 500 error and then this "Exception type: Microsoft.Azure.WebJobs.Host.FunctionInvocationException Exception message: Exception while executing function: Functions.vector_similarity_search

Exception: ModuleNotFoundError: No module named 'openai'. Cannot find module. Please check the requirements.txt file for the missing module. For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound.

Current sys.path: ['/tmp/functions\standby\wwwroot', '/home/site/wwwroot/.python_packages/lib/site-packages', '/azure-functions-host/workers/python/3.9/LINUX/X64', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/site-packages']

Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 479, in _handle__function_load_request func = loader.load_function( File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/site/wwwroot/vector_similarity_search/init.py", line 5, in

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,912 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,679 questions
0 comments No comments
{count} votes

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.