'Error! Unable to find binary python3.8 for runtime python3.8 on Vercel

When i was deploying django app on vercel i got this error

Error! Unable to find binary python3.8 for runtime python3.8 Error! Check your logs at https://komputama-qj1unu7v1-ngapa.vercel.app/_logs or run vercel logs komputama-qj1unu7v1-ngapa.vercel.app

And the log in the deployment status is

[16:26:29.158] Retrieving list of deployment files...
[16:26:31.764] Downloading 1726 deployment files...
[16:26:38.432] Warning: Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[16:26:38.619] Installing build runtime...
[16:26:42.087] Build runtime installed: 3.467s
[16:26:42.423] Looking up build cache...
[16:26:42.665] Build Cache not found
[16:26:42.856] Starting build
[16:26:42.861]       Build AMI version: Amazon Linux release 2 (Karoo)
[16:26:42.862]       Lambda runtime: python3.8
[16:26:42.862]       WSGI application: cores.wsgi.application
[16:26:42.862] ====> Selecting python version
[16:26:42.874] Error: Unable to find binary python3.8 for runtime python3.8
[16:26:42.874]     at Object.findPythonBinary (/vercel/7c1ee15da2687191/.build-utils/.builder/node_modules/@ardnt/vercel-python-wsgi/build-utils/python.js:23:9)
[16:26:42.874]     at Object.exports.build (/vercel/7c1ee15da2687191/.build-utils/.builder/node_modules/@ardnt/vercel-python-wsgi/index.js:34:34)
[16:26:42.874]     at async mut (/var/task/sandbox.js:197:17526)

This is my 'vercel.json'

{
    "build": {
        "env": {
        "SECRET_KEY": "SECRET_KEY",
        "DEBUG": "True",
        "DB_HOST": "DB_HOST",
        "DB_NAME": "DB_NAME",
        "DB_USER": "DB_NAME",
        "DB_PORT": "DB_PORT",
        "DB_PASSWORD": "DB_PASSWORD"
        }
    },
    "builds": [{
        "src": "cores/wsgi.py",
        "use": "@ardnt/vercel-python-wsgi",
        "config": { "maxLambdaSize": "15mb", "runtime": "python3.8" }
    }],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "cores/wsgi.py"
        }
    ]
}

I got stuck with this, so anyone help me?



Solution 1:[1]

First of all, you have to change your runtime version to either python 3.9 or 3.7. Python 3.8 on vercel for some unknown reason does not seem to work.

Secondly, others (me included) who have used a similar vercel.json code like yours have run into an error due to python version not being compatible with pip. A work around is to change the builder from @ardnt/vercel-python-wsgi to @vercel/python.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abubakar