6

When I publish my azure cloud functions I get the message:

Local python version '3.9.7' is different from the version expected for your deployed Function App. This may result in 'ModuleNotFound' errors in Azure Functions. Please create a Python Function App for version 3.9 or change the virtual environment on your local machine to match 'Python|3.8'.

How can I change the version to 3.9?

Quinten C
  • 660
  • 1
  • 8
  • 18

2 Answers2

11
  • You can view and set the linuxFxVersion from the Azure CLI.
  • With the az functionapp config set command, you can change the linuxFxVersion setting in the function app.
az functionapp config set --name <FUNCTION_APP> \
 --resource-group <RESOURCE_GROUP> \
 --linux-fx-version "PYTHON|3.9"

Please refer Changing Python version for more information.

Sushant Pachipulusu
  • 5,499
  • 1
  • 18
  • 30
Harshitha Veeramalla
  • 1,515
  • 2
  • 10
  • 11
  • 1
    I have the same issue, but I do not have the permission to update config(to python3.9). So I try to install python3.7. And run deployment with `func azure functionapp publish --publish-local-settings -i --overwrite-settings -y --python`. Same error occurred. I also got this error message "Unexpected character encountered while parsing value: {. Path '[0].build_summary', line 1, position 663." Any suggestions? – han shih May 24 '22 at 08:57
  • 1
    I'm getting '3.9' is not recognized as an internal or external command, operable program or batch file. – Salvatore Nedia Dec 06 '22 at 12:07
2

For those of you facing the following error when attempting the solution provided by Harshitha:

    '3.9' is not recognized as an internal or external command,
operable program or batch file.

This is because '|' needs to be escaped within the string "PYTHON|3.9" to work in PowerShell. This will work:

'Python"|"3.9'

Arunothia
  • 59
  • 3