I am trying to deploy my FastAPI project (Python) to Vercel via GitHub, however I am getting this error:
Error: could not parse requirements.txt: Failed to parse requirements file. Line 1, col 1: expected end of input
Context
The thing is that I have been able to deploy in the past and the last successful build was on Jan 6. Today, there were few issues in my project so I had to do fixes and tried to deploy again, but the build failed.
Can anyone advice on this? The requirements.txt file is not even empty and is present in my GitHub repository.
Thank you for your contribution. It still didn’t work as somehow Vercel or Github deemed my requirements.txt as empty file (?)
So, I decided to add in pyproject.toml file and added required dependencies in there instead, and now my Vercel project is able to build properly and running smoothly now.
Try creating a new requirements.txt file in notepad, then copy the content from your original requirements.txt file into the new file, then upload it into GitHub, this should resolve the error, since the error is caused because Vercel is reading two non-printable character at the start of the requirements.txt file. It worked for me.