Installation

Build and install Pysic-rs on macOS, Linux, or Windows. Two options: an editable development install (for active development) or a wheel build (for distribution).


Requirements

Tool

Version

Notes

Rust toolchain

≥ 1.70

rustup recommended

Python

≥ 3.8

3.11 recommended (rhftlab)

pip

≥ 22

—

maturin

≥ 1.0

pip install maturin



Build a Python wheel

maturin build --release
ls target/wheels/

Install the resulting wheel:

pip install target/wheels/pysic_rs-0.1.0-*.whl

Cargo features

Feature

Description

Default

python

Build the PyO3 bindings (automatically on with maturin)

no

parallel

Enable Rayon parallelism in hot loops

no

maturin develop --release --features parallel

Troubleshooting

maturin not found

pip install --upgrade maturin

Linker / toolchain errors on macOS

xcode-select --install          # if Command Line Tools are missing
rustup update stable

Import fails with ModuleNotFoundError: pysicrs._core

Rebuild the extension — the source module is Rust, so it must be compiled:

maturin develop --release

Slow release builds on first run

The first --release build compiles all dependencies from source; subsequent builds are cached by cargo.


Optional interop: Optimiz-rs (statistics)

For probabilistic/statistical backgrounds, Pysic-rs integrates with Optimiz-rs (MCMC, HMM, SDE, Kalman filters). The two libraries are designed to be used side by side from the same Python environment:

pip install maturin
maturin develop --release     # optimiz-rs
maturin develop --release     # pysic-rs (in its own checkout)