ModuleNotFoundError: No module named 'fcntl'

Hi everyone,

I’m currently taking the Django Part 3 course using Windows 10, and I came across this error when running the command gunicorn storefront.wsgi:

gunicorn storefront.wsgi
Traceback (most recent call last):
File “C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “C:\Users\chris\AppData\Local\Programs\Python\Python39\lib\”, line 87, in run_code
exec(code, run_globals)
File "C:\Users\chris.virtualenvs\storefront3-RloiewB3\Scripts\gunicorn.exe_main
.py", line 4, in
File “C:\Users\chris.virtualenvs\storefront3-RloiewB3\lib\site-packages\gunicorn\app\”, line 9, in
from import Application
File “C:\Users\chris.virtualenvs\storefront3-RloiewB3\lib\site-packages\gunicorn\app\”, line 11, in
from gunicorn import util
File “C:\Users\chris.virtualenvs\storefront3-RloiewB3\lib\site-packages\gunicorn\”, line 8, in
import fcntl
ModuleNotFoundError: No module named ‘fcntl’

This happens because gunicorn does not support Windows, so a workaround I’ve found was to use waitress instead.

Use this command to install waitress for your proyect:

pipenv install waitress

And then, instead of using gunicorn storefront.wsgi, use this command:

waitress-serve --listen=*:8000 myapp.wsgi:application

Source: python - Does Gunicorn run on Windows - Stack Overflow

1 Like

That’s great I was thinking about running it in a docker container.