docs/
Outline
---
title: From a missing fcntl error to a real Linux setup on Windows
slug: wsl-setup
lang: en
published: 2026-10-31
words: 446
lines: 92
size: 2.6 KB
read: 3 min read
reel: I brought Linux to me, inside Windows
---
My website backend would not start on Windows. The same code ran fine on the server. The problem was the environment, not the code. This is the exact error, why it happens, and the setup I use now.
The error
PS C:\sina_codes\website\backend> uv run gunicorn sina.asgi:application -c gunicorn.conf.py
Traceback (most recent call last):
File "...\gunicorn\util.py", line 7, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
fcntl is part of Python, but only on Unix. Windows builds do not ship it, and gunicorn imports it on line 7 of util.py. No package you install fixes that. The server process itself does not run on Windows.
Servers run Linux, and most tools land on Linux first. Agents like Claude Code also work in the terminal, so the shell they get decides what they can do. I did not want to leave Windows or dual boot, so I brought Linux in.
1. Install WSL
Open PowerShell as administrator:
wsl --install -d Ubuntu
Restart when it asks, then open Ubuntu from the Start menu and pick a username and password. Check that you are on version 2:
wsl --version
wsl --list --verbose
2. Give it enough machine
By default WSL takes a share of your RAM and cores. Set them yourself in C:\Users\<you>\.wslconfig. These are my real values, for a laptop with a lot of RAM. Scale them to yours.
[wsl2]
processors=12
memory=20971520000
swap=8388608000
That is about 19.5 GB of RAM and 7.8 GB of swap. Apply it with:
wsl --shutdown
3. Keep the project inside Linux
This is the step people skip. Clone into your Linux home, not /mnt/c.
cd ~
git clone <your-repo-url>
Files under /mnt/c cross a bridge to Windows on every read. Installs and test runs get slow, and file watchers can miss changes. Inside ~ you get a native Linux filesystem.
4. Open your editor in the same place
Install the WSL extension in VS Code or Cursor, then run this from inside the project:
code .
The editor window stays on Windows. Its terminal, language servers and extensions run in Linux, in the same place as your project and your agent.
5. The same project, this time it starts
curl -LsSf https://astral.sh/uv/install.sh | sh
cd ~/sina_codes/website/backend
uv run gunicorn sina.asgi:application -c gunicorn.conf.py
[INFO] Starting gunicorn 26.2.0
[INFO] Using worker: uvicorn_worker.UvicornWorker
Run the agent here too
curl -fsSL https://claude.ai/install.sh | bash
cd ~/your-project
claude
Now the agent runs the same shell as your server, so what works for it has a real chance of working in production.
| My website backend would not start on Windows. The same code ran fine on the server. The problem was the environment, not the code. This is the exact error, why it happens, and the setup I use now. |
| ## The error |
| ```text |
| PS C:\sina_codes\website\backend> uv run gunicorn sina.asgi:application -c gunicorn.conf.py |
| Traceback (most recent call last): |
| File "...\gunicorn\util.py", line 7, in <module> |
| import fcntl |
| ModuleNotFoundError: No module named 'fcntl' |
| ``` |
| `fcntl` is part of Python, but only on Unix. Windows builds do not ship it, and gunicorn imports it on line 7 of `util.py`. No package you install fixes that. The server process itself does not run on Windows. |
| Servers run Linux, and most tools land on Linux first. Agents like Claude Code also work in the terminal, so the shell they get decides what they can do. I did not want to leave Windows or dual boot, so I brought Linux in. |
| ## 1. Install WSL |
| Open PowerShell as administrator: |
| ```powershell |
| wsl --install -d Ubuntu |
| ``` |
| Restart when it asks, then open Ubuntu from the Start menu and pick a username and password. Check that you are on version 2: |
| ```powershell |
| wsl --version |
| wsl --list --verbose |
| ``` |
| ## 2. Give it enough machine |
| By default WSL takes a share of your RAM and cores. Set them yourself in `C:\Users\<you>\.wslconfig`. These are my real values, for a laptop with a lot of RAM. Scale them to yours. |
| ```ini |
| [wsl2] |
| processors=12 |
| memory=20971520000 |
| swap=8388608000 |
| ``` |
| That is about 19.5 GB of RAM and 7.8 GB of swap. Apply it with: |
| ```powershell |
| wsl --shutdown |
| ``` |
| ## 3. Keep the project inside Linux |
| This is the step people skip. Clone into your Linux home, not `/mnt/c`. |
| ```bash |
| cd ~ |
| git clone <your-repo-url> |
| ``` |
| Files under `/mnt/c` cross a bridge to Windows on every read. Installs and test runs get slow, and file watchers can miss changes. Inside `~` you get a native Linux filesystem. |
| ## 4. Open your editor in the same place |
| Install the WSL extension in VS Code or Cursor, then run this from inside the project: |
| ```bash |
| code . |
| ``` |
| The editor window stays on Windows. Its terminal, language servers and extensions run in Linux, in the same place as your project and your agent. |
| ## 5. The same project, this time it starts |
| ```bash |
| curl -LsSf https://astral.sh/uv/install.sh | sh |
| cd ~/sina_codes/website/backend |
| uv run gunicorn sina.asgi:application -c gunicorn.conf.py |
| ``` |
| ```text |
| [INFO] Starting gunicorn 26.2.0 |
| [INFO] Using worker: uvicorn_worker.UvicornWorker |
| ``` |
| ## Run the agent here too |
| ```bash |
| curl -fsSL https://claude.ai/install.sh | bash |
| cd ~/your-project |
| claude |
| ``` |
| Now the agent runs the same shell as your server, so what works for it has a real chance of working in production. |





