Environment:Nautechsystems Nautilus trader Python Cython Rust Runtime
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Build_System |
| Last Updated | 2026-02-10 08:30 GMT |
Overview
Python 3.12+ runtime with Cython 3.2.4 compiled extensions and Rust 1.93.0 core via PyO3 bindings, supporting Linux, macOS, and Windows (with limitations).
Description
NautilusTrader is a hybrid Python/Cython/Rust application. The Python layer provides the user-facing API, Cython compiles performance-critical paths (strategy engine, risk engine, order factories) into C extensions, and a Rust core (accessed via PyO3/maturin) handles the model layer, serialization, and adapter infrastructure. The build system uses Poetry with a custom build script that orchestrates both Cython compilation and Rust/maturin builds.
Platform notes:
- Windows: High-precision mode (128-bit integers) is not supported. The `uvloop` event loop is unavailable.
- ARM64 Linux: Requires `PYTHON_LIB_DIR` environment variable for linking.
- macOS: Fully supported on both Intel and Apple Silicon.
Usage
This environment is required by all NautilusTrader functionality. Every backtest, live trading node, strategy, and data catalog operation depends on the compiled Cython extensions and Rust PyO3 bindings being present. Without a successful build of both layers, no NautilusTrader code can execute.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | Windows has feature limitations (no high-precision, no uvloop) |
| Python | >= 3.12, < 3.15 | Python 3.12, 3.13 supported; 3.14 alpha/dev support |
| Rust | >= 1.93.0 (edition 2024) | Required for building the core library from source |
| C Compiler | gcc/clang (Linux/macOS), MSVC (Windows) | Needed for Cython extension compilation |
| Disk | 2GB+ free | For compiled extensions and build artifacts |
Dependencies
Build System Packages
- `setuptools` >= 80
- `poetry-core` == 2.2.1 (pinned for stability)
- `cython` == 3.2.4 (pinned for stability)
- `numpy` >= 1.26.4 (build-time requirement)
- `maturin` (for Rust/PyO3 builds in v2 package)
Core Python Packages
- `click` >= 8.0.0, < 9.0.0
- `fsspec` >= 2025.2.0, <= 2026.1.0
- `msgspec` >= 0.20.0, < 1.0.0
- `numpy` >= 1.26.4
- `pandas` >= 2.3.3, < 3.0.0
- `portion` >= 2.6.1
- `pyarrow` >= 22.0.0
- `pytz` >= 2025.2.0
- `tqdm` >= 4.67.3, < 5.0.0
- `uvloop` == 0.22.1 (Linux/macOS only; pinned for stability)
Rust Cargo Features
- `extension-module` — Python extension module support (required)
- `high-precision` — 128-bit integer precision (Linux/macOS only)
- `redis` — Redis backend for infrastructure
- `postgres` — PostgreSQL backend for infrastructure
- `defi` — DeFi/Blockchain adapter support
- `hypersync` — HyperSync client support
- `tracing-bridge` — Tracing bridge support
Credentials
The following build-time environment variables control compilation:
- `RUSTUP_TOOLCHAIN`: Rust toolchain selection (default: "stable")
- `BUILD_MODE`: Cargo build mode (default: "release")
- `HIGH_PRECISION`: Enable 128-bit precision (default: "true", forced off on Windows)
- `PARALLEL_BUILD`: Use all CPUs for compilation (default: "true")
- `PYO3_ONLY`: Skip Cython extensions, build only Rust/PyO3 (default: off)
- `PYTHON_LIB_DIR`: Python library directory (required on ARM64 Linux)
Quick Install
# Install from PyPI (pre-built wheels)
pip install nautilus_trader
# Install with optional adapter dependencies
pip install "nautilus_trader[betfair,docker,visualization]"
# Build from source (requires Rust toolchain)
pip install numpy cython==3.2.4
pip install -e .
Code Evidence
Platform detection from `build.py:25-31`:
IS_LINUX = platform.system() == "Linux"
IS_MACOS = platform.system() == "Darwin"
IS_WINDOWS = platform.system() == "Windows"
IS_ARM64 = platform.machine() in ("arm64", "aarch64")
High-precision limitation from `build.py:53-57`:
HIGH_PRECISION = os.getenv("HIGH_PRECISION", "true").lower() == "true"
if IS_WINDOWS and HIGH_PRECISION:
print(
"Warning: high-precision mode not supported on Windows "
"(128-bit integers unavailable)\n"
"Forcing standard-precision (64-bit) mode",
)
HIGH_PRECISION = False
Python version constraint from `pyproject.toml:25`:
requires-python = ">=3.12,<3.15"
Rust version constraint from `Cargo.toml:45`:
rust-version = "1.93.0"
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `requires-python >=3.12,<3.15 not satisfied` | Python version too old or too new | Install Python 3.12 or 3.13 |
| `error: can't find Rust compiler` | Rust toolchain not installed | sh` |
| `Warning: high-precision mode not supported on Windows` | Building on Windows with default settings | Expected behavior; 64-bit precision is used automatically |
| `ModuleNotFoundError: No module named 'nautilus_pyo3'` | Rust/PyO3 extensions not built | Run `pip install -e .` or set `PYO3_ONLY=true` to build only Rust extensions |
Compatibility Notes
- Windows: High-precision mode (128-bit integers) is unavailable. The `uvloop` event loop package is not supported; the standard `asyncio` event loop is used instead.
- ARM64 Linux (aarch64): May require setting `PYTHON_LIB_DIR` for proper linking during build.
- Python 3.14: Some optional adapter dependencies (Interactive Brokers, dydx) are not yet available for Python 3.14 due to upstream package constraints.
- macOS Apple Silicon: Fully supported with native ARM64 compilation.
Related Pages
- Implementation:Nautechsystems_Nautilus_trader_BacktestEngine_Init
- Implementation:Nautechsystems_Nautilus_trader_TradingNode_Init
- Implementation:Nautechsystems_Nautilus_trader_Strategy_Init
- Implementation:Nautechsystems_Nautilus_trader_BacktestNode_Run
- Implementation:Nautechsystems_Nautilus_trader_RiskEngine_Init