Issue with Deployment (Flask/Nextjs), I think its a python3.12 error?

Hello,

I keep running into issues trying to deploy a test project, essentially I took the template Flask/Next-js project and did some changes. Threw it into my github repo, and connected it to Vercel, but I could never deploy.

The error is:
Error: Command failed: pip3.12 install --disable-pip-version-check --target . --upgrade -r /vercel/path0/frontend/nextjs-flask/requirements.txt
14:43:43.873ERROR: Exception:

File “/tmp/pip-build-env-bqqrnj3k/overlay/lib/python3.12/site-packages/setuptools/init.py”, line 10, in
import distutils.core
ModuleNotFoundError: No module named ‘distutils’

I am new to this sort of thing so it could definitely be an error with some code I added, but notably, a quick google search shows that distutils was discontinued after Python3.10, and it seems like whatever is doing the deploy action is using Python3.12 maybe?

I have tried specifying to use Python3.10 in the requirements.txt and also removing any code that I think might cause distutils to be used but they give further errors.

Will gladly take any help, including “You’re doing it wrong” :sweat_smile:, would prefer to know now rather than later. Thanks!

Thanks for reaching out, @grahamstelzer. I have a solution that might seem silly, but I’ve seen it work for similar errors. Go into the project’s settings and change the Node.js version from the default 20.x to 18.x and redeploy.

I tried with my own copy of the template and that got it working for me. Please let me know whether that helps you :pray:

2 Likes

Hey this worked! Thank you so much, and I appreciate the quick reply as well :slight_smile:

1 Like

Had the same issue. Ended up getting it working on a Python 3.11 environment locally.

1 Like

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