We cannot specify the Python runtime version with FUNCTIONS_EXTENSION_VERSION. The FUNCTIONS_EXTENSION_VERSION setting is specifically for specifying the version of the Azure Functions runtime, not the version of Python.
The Azure Functions runtime is the host that runs your functions. It's a separate concept from the Python runtime. Each version of the Azure Functions runtime has a range of versions of Python (and other languages) that it supports, but you can't use the FUNCTIONS_EXTENSION_VERSION
setting to choose a specific Python version.
The version of Python that's used in your function app is typically determined by the environment in which the app is running. When running locally, this will be the version of Python that's available in your local environment. When running in Azure, the Python version is determined by the configuration of your Azure Functions host.
If you want to specify a Python version for local development, you can do so using a Python version management tool like pyenv
, and creating a .python-version
file in the root of your function app project. For deployment in Azure, you specify the Python version when you create the Function App.
Remember to check the Azure Functions runtime support for your chosen Python version. Azure Functions 4.x runtime supports Python 3.7, 3.8, 3.9 and 3.10 for now.
Prerequisite check for Python
$ az --version
$ az login
$ func --version
$ python --version
Create and activate a virtual environment with virtualenv package manager
virtualenv (for Python 2) and venv (for Python 3) allow you to manage separate package installations for different projects.
$ mkdir azure-demo
$ cd azure-demo
$ pyenv local 3.10.5
$ python -m venv .venv
Continue reading