[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# FastAPI deployment failure: Could not parse requirements.txt on Vercel

129 views · 3 likes · 4 posts


ev. (@evelynray) · 2026-02-13 · ♥ 1

## Problem
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.


Amy Egan (@amyegan) · 2026-02-13

That error usually means there’s a parsing error with the `requirements.txt` file. Possibly encoding issues or just an unexpected character.

Quick fix to try:

```bash
 # Recreate requirements.txt
 pip freeze > requirements.txt
 
 # Verify it's not empty
 cat requirements.txt
 
 # Commit and push
 git add requirements.txt
 git commit -m \\Fix requirements.txt\\
 git push
```

If that doesn’t solve it, can you share:
 - The first few lines of your requirements.txt file
 - The output of `file requirements.txt` command (to check encoding)
 - Whether you’re using any special characters or comments in the file


ev. (@evelynray) · 2026-02-14

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.


Rohit Kumar (@code-hamster-rohit) · 2026-02-18 · ♥ 2

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.