Installation¶
Requirements¶
Nmag currently targets Linux and Python 3.10 or newer. A normal installation needs:
- Python,
venv, andpip; and - a C compiler for dependencies without a wheel for your platform.
Git is only required if you choose the source checkout setup. The published package is the simplest option when you want to run Nmag without cloning the repository.
On Ubuntu or Debian:
Install from PyPI¶
Create a virtual environment and install the published package:
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install nmag-python-3
This installation is sufficient for normal simulations and uses the standard Python/Numba execution path. The optional native Rust accelerator is available when installing from a source checkout.
Run a simulation with:
Install from a source checkout¶
Clone the repository and use its setup script:
The script creates or reuses .venv, installs Nmag in editable mode, offers to
build the optional Rust accelerator, and runs the standard checks. It invokes
the virtual environment explicitly, so activation is not required.
Run a simulation with:
You may activate the environment if that is more convenient:
Manual source setup¶
For CI or an existing environment:
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e .
Normal simulations do not require Rust. To build the optional accelerator,
install Rust with rustup, install the rust extra, and run
the build script:
Python 3.12 accelerator builds on Ubuntu or Debian also need
libpython3.12-dev. Substitute the development package matching your Python
version.
Verify the installation¶
The published package exposes reusable mesh and VTK helpers directly:
Then run the quickstart. If the optional accelerator was built,
nmag.parallel_runtime_info() reports its effective thread configuration.
Building this documentation¶
Documentation tools are isolated in a separate extra:
Use mkdocs build --strict before submitting documentation changes.