I have a python service that uses fastapi as a web interface. I need to make an executable file and hence I am using PyInstaller.
I keep getting the following error:
File "..../miniconda3/lib/python3.7/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2912, in _load_package
self._load_module(fqname, fp, buf, stuff)
File "..../miniconda3/lib/python3.7/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2093, in _load_module
m = self._load_package(fqname, pathname, packagepath)
RecursionError: maximum recursion depth exceeded while calling a Python object
I added import sys; sys.setrecursionlimit(50000)
to the original python file as well as in the spec but still getting the same problem.
The interesting thing is that I don't get that error if I don't use fastapi (It works with Flask for example). Looks like PyInstaller has some issue with fastapi.
Does anybody have any idea how to solve this issue?
This is the code in my main python function:
from fastapi import FastAPI
import uvicorn
app = FastAPI()
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", workers=1, port=5000)