How to change the Python version?

I successfully deployed python app on render but gives me runtime error. The reason is that my app requires python version 3.11 while the default version is 3.7. How can I change the default python version.
I am using Free account.

By setting an environment variable with the specific version. More information here: Specifying a Python Version | Render

Thanks for the reply but if didn’t worked. I set it to 3.10.5

Hmm, I have a project using 3.11.0 and during the build it’s using the correct version:

May 9 08:26:19 PM  ==> Downloading cache...
May 9 08:26:36 PM  ==> Transferred 230MB in 10s. Extraction took 4s.
May 9 08:26:59 PM  ==> Using Python version: 3.11.0

Maybe they aren’t hosting 3.10.5 anymore, does the latest of 3.10 work for you 3.10.11? I do wish they had a list of the supported versions, the docs are light on what versions are available.

Hey,

There should be no issues setting “PYTHON_VERSION” to 3.10.5 as we have this version cached. You could try to “Clear build cache & deploy” or raise a ticket via the “Contact Support” form on the dashboard.

Regards.
Jérémy, Render Support

please am having this issue with changing pythin version, i dint even have idea on how to do so, please can someone guid me on how to do that.
thanks

Please check https://render.com/docs/python-version and open a support ticket if you need any specific assistance.

Regards.
Jérémy, Render Support

well, here is my render.yaml if,

previewsEnabled: true
services:
  - type: web
    plan: standard
    name: app
    env: 
      - type: python
        PYTHON_VERSION: 3.10.5
    envVars:
      - key: my_env
        value: 27bed0121b936f977122d02fa7a45c7d

please if there is anyway you can help me

Close, but that’s no valid syntax (Blueprint Specification | Render), try this:

previewsEnabled: true
services:
  - type: web
    plan: standard
    name: app
    env: python
    envVars:
      - key: PYTHON_VERSION
        value: 3.10.5
      - key: my_env
        value: 27bed0121b936f977122d02fa7a45c7d

How can I set the python version environment variable if I am not using Docker. Or do I have to use Docker?

Please see our docs at Environment Variables | Render - no need to be using Docker.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.