The short answer
In your project folder run ncg pack . --python --install, then ncg check .ncg/build and ncg submit. The first command downloads wheels for Linux x86-64 and Python 3.12 only, writes them into a vendor folder, adds a start script named server, and packs everything. It installs nothing unless you pass --install, and it never touches your own virtual environment.
What the host provides
- Python 3.12 and the standard library. Nothing else. There is no pip on the servers and no network install at start.
- Your libraries, as wheels. The command asks for
cp312andmanylinuxx86-64 wheels with no source builds (--only-binary=:all:), so no library is compiled and no install script runs.ncgalso refuses, before pip starts, anyrequirements.txtline that is a folder, a web address, a repository or a pip option such as--index-urlor--no-binary, because pip would build those with their own build code on your computer. Use plain lines such aswebsockets==14.1; pip is given a cleaned copy. - A start script named
server. It setsPYTHONPATHto yourvendorfolder, then runs your file withpython3. Your manifest's command is that script. - Ubuntu 24.04, so shipped Linux libraries must not need a newer glibc than 2.39.
Steps
- List every library in
requirements.txt, pinned if you can. - Listen on
0.0.0.0and read the port from the environment with a default. - Add a health route and a join check that answers with a known reply. The Python prompt makes your AI add them, and the clean stop on SIGTERM.
- Run
ncg init ., thenncg pack . --python --install, thenncg check .ncg/build.
If your WebSocket is not at the root path
A FastAPI or Starlette route such as /ws is not the root. Declare it in ncg.json as "wsPath": "/ws". The path is fixed by you at release. A player's path and query never reach your server. See the Node guide for the allowed characters.
What does not work
- A library with no Linux wheel. If a package only ships source,
--only-binarystops with the package named. Pick a version that has a wheel, or another library. - Extensions built for Windows, macOS, ARM or Alpine. Only
cp312manylinuxx86-64 is accepted. - Designs that need a plain web request before the WebSocket. The gateway passes WebSocket connections only, so long polling and HTTP matchmaking do not work.
- A source folder. A project with
requirements.txtand no vendored packages is held with the command to run.
Mistakes that waste the most time
| Mistake | What you see | Fix |
|---|---|---|
| Zipped your own virtual environment | Windows or macOS extensions refused | Run ncg pack --python --install instead |
| Wheel for Python 3.11 | Wheel for another system | The host runs 3.12; install for 3.12 |
Missing requirements.txt entry | Import error at start | Add it and pack again |
Listening on 127.0.0.1 | Health check never passes | Bind 0.0.0.0 |
Frequently asked questions
Does NetCraftGames run pip for me?
No. Nothing on our servers installs packages. ncg pack . --python --install downloads Linux wheels on your computer and puts them in the archive.
Can I use FastAPI?
A FastAPI WebSocket route works, with the route declared as the WebSocket path. It was run through the gateway locally with uvicorn. Plain web endpoints beyond the health and join checks are not served to players.
Is there a Python game running on NetCraftGames today?
Not yet. The preparation, the checks and the path setting are built and tested locally with real libraries, but no Python game has run on our servers, and nothing here is certified.
Sources
- MDN: WebSockets API, accessed October 3, 2026