# Nuitka


Nuitka is a Python-to-C compiler that translates CPython bytecode into C source, then compiles and links the result against `libpython`. The output runs without a separate Python installation and can ship as a standalone folder, a self-extracting single-file executable, or an importable extension module. Nuitka runs on Linux, macOS, and Windows; the build machine needs a C toolchain (`gcc`, `clang`, or MSVC). Install it with `uv tool install nuitka` or `pipx install nuitka`. Nuitka is AGPL-3.0+ with a runtime exception for compiled output, so the license does not carry over to the applications it produces.

## Key Features

- Full-program compilation from Python source to a native executable
- Acceleration mode for compiling a single module in place
- `--mode=standalone` for a self-contained folder of binaries and data
- `--mode=onefile` for a single self-extracting binary
- `--mode=module` for producing importable `.so` or `.pyd` extensions
- `--mode=app` for macOS `.app` bundles
- Plugin system with package-specific configs for NumPy, SciPy, scikit-learn, PyTorch, and TensorFlow
- Link-time optimization (LTO) and profile-guided optimization (PGO) toggles

## How Nuitka Works

Nuitka departs from the freezer model used by [PyInstaller](https://pydevtools.com/handbook/reference/pyinstaller.md) and [cx_Freeze](https://pydevtools.com/handbook/reference/cx-freeze.md). Those tools ship the original `.pyc` files plus a bootloader. Nuitka instead generates C source code that calls `libpython` through the CPython C API, then compiles that source with gcc, clang, or MSVC.

The result is a native binary that embeds compiled program logic rather than shipping the original `.pyc` files in a bootloader bundle. Import statements resolve at compile time, and C compilation can drop unused attributes and fold constants. Recovering source-level logic from the binary is harder than extracting bundled `.pyc` files, which is the main reason teams choose Nuitka over a freezer.

Compilation is slower than bundling. A medium-size application that PyInstaller packages in 30 seconds can take 5 to 15 minutes in Nuitka because every module passes through a C compiler. Output binaries are also larger than PyInstaller equivalents on the same input.

### Performance

Nuitka's published Python 2.7 pystone benchmark reports 3.353× CPython performance with LTO and 3.663× with PGO. Those numbers come from a microbenchmark, not general application throughput. CPU-bound pure-Python workloads may improve by roughly 10% to 40% in practice, while I/O-heavy or C-extension-heavy programs often see little change. Nuitka is a compile-ahead-of-time packager that happens to produce faster code, not a drop-in JIT replacement.

### Machine learning packages

Recent releases added built-in package-specific rules for PyTorch, TensorFlow, scikit-learn, and SciPy. The rules prune unused operator kernels and skip compiling TensorFlow's generated code, which was previously a build-time blocker. ML projects still need the right plugin enabled for each framework, and not every model-serving stack compiles cleanly on the first try.

### Antivirus false positives

Onefile binaries trigger the same false positives that affect PyInstaller and cx-freeze. The self-extracting stub looks like a dropper to signature-based scanners. Code signing on macOS and Windows, plus submitting binaries to Microsoft and vendor allowlists, remains part of a production distribution pipeline.

## Commercial Edition

Nuitka ships a paid tier alongside the AGPL community edition:

- Nuitka Commercial (€250 per year): constant and data-file obfuscation, encrypted tracebacks, protection against runtime DLL and extension-module swapping, Windows 7 and XP targets, RHEL 7 portable builds, Windows Service deployment, and access to commercial-only package configs like legacy PySide2.
- Full Package (€400 per year): Nuitka Commercial plus priority support.

The commercial source code cannot be redistributed. Compiled output can be shipped without per-seat runtime limits, and that right survives the subscription ending. Confirm current pricing and scope at [nuitka.net/doc/commercial.html](https://nuitka.net/doc/commercial.html) before purchase.

## Pros

- Produces a native binary with source-code protection beyond bytecode obscurity
- Faster runtime than CPython on CPU-bound pure-Python code
- Standalone, onefile, module, and macOS app-bundle targets from one tool
- Active maintenance with a commercial support track
- Built-in configs for the packages that most often break bundlers (PyTorch, TensorFlow, SciPy)

## Cons

- Build times of minutes, not seconds, on non-trivial applications
- Larger output than PyInstaller for equivalent inputs
- AGPL-3.0 requires care when integrating the tool itself into proprietary build systems; the runtime exception covers the generated binary
- ML frameworks need the right plugin, and new package versions occasionally break until a config lands
- Antivirus false positives on unsigned onefile binaries require the same signing and reputation work as any other freezer

## Learn More

- [Nuitka User Manual](https://nuitka.net/user-documentation/)
- [Nuitka Performance Benchmarks](https://nuitka.net/user-documentation/performance.html)
- [Nuitka Commercial](https://nuitka.net/doc/commercial.html)
- [Nuitka GitHub Repository](https://github.com/Nuitka/Nuitka)
- [PyInstaller](https://pydevtools.com/handbook/reference/pyinstaller.md) is the bundler alternative
- [cx_Freeze](https://pydevtools.com/handbook/reference/cx-freeze.md) is the PyPA-adjacent freezer alternative
- [Briefcase](https://pydevtools.com/handbook/reference/briefcase.md) handles native app packaging for mobile and desktop
- [How do I ship a Python application to end users?](https://pydevtools.com/handbook/explanation/how-do-i-ship-a-python-application-to-end-users.md) frames when to reach for a compiler versus a freezer
