How to change Azure App Service Python version from 3.9.7 to 3.9.12?

Question:

I am trying to deploy an application on Azure App Service. I have created a deployment with Python 3.9.7, but my app needs Python 3.9.12. How do I upgrade python’s version?

In Azure App Service > Configuration > General Settings > Python minor version, there is no 3.9.12 available. So I have to upgrade it by SSH. But, I don’t understand Linux.

Can anyone tell me a command to upgrade my python version to 3.9.12 using bash?

Asked By: Sticky

||

Answers:

enter image description here

Created the Python Web App from the Azure Portal with the version 3.9 and shown as 3.9.7 in the SSH Console.

In the Configuration, it shown me only these versions in minor and major dropdown lists:

enter image description here

Using this Azure CLI cmdlet az webapp config set ..., I have set the Python version from 3.9.7 to 3.9.12 but not reflected specifically like 3.9.X in the SSH Console. It is showing the current python version of that web app with the az webapp config show cmdlet:

az webapp config set --resource-group HariTestRG --name krishpywebapp101 --linux-fx-version "PYTHON|3.9.12"

enter image description here
enter image description here

Result:

az webapp config show --resource-group HariTestRG --name krishpywebapp101 --query linuxFxVersion

enter image description here

Answered By: Hari Krishna

Using the portal/blessed images(available images) you cannot upgrade your webapp runtime to particular python minor version.

Currently available minor python versions that can be deployed from portal are 3.7.12,3.8.12,3.9.7,3.10.4.

If you want to run a particular runtime minor version (python 3.9.12) in your web app it is always recommended to use custom docker image using that you can run the unsupported versions as well as mentioned in this documentation.

enter image description here

Here is the reference documentation to create custom docker container on Azure app service which has sample Dockerfile as well.

Refer to this Docker Hub registry for python images and select a particular image based on your requirement.

Note: I have looked at the official docker hub registry for python as well unfortunately we do not have any image that support v3.9.12 we have images for V3.9.15.

Answered By: VenkateshDodda-MSFT