haystack icon indicating copy to clipboard operation
haystack copied to clipboard

How to run REST-API in Windows-10, as Gunicorn is not supported by Windows?

Open ahsantfw opened this issue 3 years ago • 5 comments

Question I am unable to run this command "gunicorn rest_api.application:app -b 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker -t 300" beacuse it's Gunicorn is not available in windows.

Additional context I have seen some alternatives like waitress etc but I can't understand how to fine tune this command to waitress command. Anyone who can give alternative of this line for windows?

FAQ Check Yes done, but didn't find answer

ahsantfw avatar Sep 09 '21 10:09 ahsantfw

Hi @ahsantfw You're right that Gunicorn is not available in windows. Our recommended way of deploying a Haystack API is to run the application as a Docker container. Have you seen our recent blog post on building a REST API for question answering? It describes in detail how to setup a Haystack REST API on an AWS EC2 instance (or other environments).

julian-risch avatar Sep 09 '21 11:09 julian-risch

Yes, I had tried it first before implementing it locally. But It was not running, check issue "#1421". So I tried it, There are some alternatives of GUNICORN in windows like waitress ,NGINX etc., but I am unable to convert gunicorn command into one of windows compatible servers command. can somebody convert it "gunicorn rest_api.application:app -b 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker -t 300" to some other windows compatible servers like waitress or NGINX. waitress would be preferred.

ahsantfw avatar Sep 09 '21 12:09 ahsantfw

Okay, I see. I am sure that @oryx1729 will be able to help with #1421 and maybe he can also have a quick look at Windows alternatives for gunicorn.

julian-risch avatar Sep 09 '21 13:09 julian-risch

Hi @ahsantfw, you could test if Uvicorn is supported on Windows? You can install it by pip install Uvicorn & run Haystack with uvicorn rest_api.application:app.

oryx1729 avatar Sep 13 '21 08:09 oryx1729

@ahsantfw I don't know if this is still a problem for you, but I've found the best approach for doing this sort of development on Windows is to use WSL2 + Ubuntu. You can install it now from an administrator powershell with wsl --install. Then you just work as if it was native Ubuntu (though it doesn't have systemd, so you can start docker with sudo service docker start)

nickchomey avatar Sep 12 '22 21:09 nickchomey

REST API have been migrated to Uvicorn: https://github.com/deepset-ai/haystack/pull/4304. Closing this thread,

ZanSara avatar Mar 13 '23 14:03 ZanSara