When vercel deploying my python app gives Error: Unable to find any supported Python versions

344 views Asked by At

While installing the web app I prepared using python, vertex ai google chat bison model and fastapi, I constantly get Error: Unable to find any supported Python versions error and the installation does not complete. I also specified the Python version in the Requirements file, but it did not help. I use Vercel with github and all my files are in the root directory. My vercel deployment error screenshot is like this:

enter image description here

My files are app.py, .env , Procfile , requirements.txt and vercel.json. The contents of some files are as follows:

.env file:

GOOGLE_API_KEY=MYAPIKEY

Procfile:

web: gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app

requirements.txt:

fastapi==0.110.0

markdown==3.6

python-dotenv==1.0.1

gunicorn==21.2.0

uvicorn==0.29.0

uvicorn-worker==0.1.0

python-multipart==0.0.9

google-generativeai==0.4.1

google-cloud-aiplatform==1.44.0

python==3.9.0

vercel.json:

{
  "devCommand": "gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app",
  "builds": [
    {
      "src": "/app.py",
      "use": "@vercel/python"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/app.py"
    }
  ]
}

My project runs very well on my computer in the VsCode environment, but I am having this problem when deploying on Vercel.

I tried editing the vercel.json file many times. I updated the versions of the requirements in the requirements.txt file, i set the python version to 3.9.0 which is supported by vercel at requirements file but it did not solve my problem. I would be very happy if you could help me with what I can do.

2

There are 2 answers

0
Thijmen Kurk On

I had the same issue just now, resolved it by downgrading the Node.js version from 20.x to 18.x in Project Settings.

0
Kauan Sena On

I opened a thread about the same issue on vercel's github. In my case, even downgrading to node 18.x, the building error persists as "Error: Unable to find any supported Python versions".

This has never happened before using vercel’s own templates

https://github.com/orgs/vercel/discussions/6287