Installation¶
Every MechDSL package is published on PyPI under the MIT license, so the fastest way
in is pip install. Installing from source with uv is
the path for contributors and for anyone who wants the runnable examples/ tree.
In a hurry?
pip install "mechdsl-workbench[mechdsl]" then mechdsl-workbench gives you the
whole toolchain behind a browser UI — LaTeX in the left pane, generated Taichi in
the right. See the workbench page.
What's on PyPI¶
| Install | What it gives you |
|---|---|
pip install mechdsl-core |
The FEM compiler: LaTeX → emitted Taichi solver source. Taichi-free. (PyPI) |
pip install "mechdsl-core[verify]" |
The full engine — adds taichi, ti-runtime, and algo2code so you can run and verify solves |
pip install algo2code |
The algorithm transpiler on its own. Zero runtime dependencies, stdlib only. (PyPI) |
pip install ti-runtime |
The neutral Taichi runtime: vector primitives, Tier-1 @ti.func helpers, injection seams. (PyPI) |
pip install "mechdsl-workbench[mechdsl]" |
The browser workbench plus the engine, in one command. (PyPI) |
All five are released together and currently sit at 0.2.1.
Requirements¶
- Python 3.11–3.13 for
mechdsl-core,algo2code, andti-runtime(requires-python = ">=3.11,<3.14"). - Python 3.12 for
mechdsl-workbench, which pins>=3.12,<3.13. - No compiler toolchain, no system FEM library. Taichi ships prebuilt wheels and JIT-compiles to CPU or GPU at run time.
Install from PyPI¶
Just the compiler (lean, Taichi-free)¶
This is everything you need to emit code: parse % mechanics directives, derive
stress and tangent symbolically, plan contractions, and print Taichi source. It pulls
only sympy, numpy, scipy, opt-einsum, pyyaml, and nrpylatex — no Taichi, so
the install stays small and imports cleanly in Taichi-free environments.
from mechdsl import compile_latex
bundle = compile_latex("% mechanics dim 3\n% mechanics cell hex8\n"
"% mechanics formulation total_lagrangian\n"
"% mechanics material svk --E 200e3 --nu 0.3\n")
print(bundle.content_hash())
The full engine (run and verify solves)¶
The verify extra adds taichi, ti-runtime, and algo2code — the complete
installation. Expect a noticeably larger download; Taichi alone is around 170 MB.
Take this one if you want to execute generated kernels, run the verification
harness, or use the generated matrix-free PCG solver.
Why the split?
Only mechdsl.integration.verify() ever touches Taichi, and it imports it lazily
at call time. The emit, transpile, capabilities(), and model_catalog()
surfaces are proven Taichi-free by the test suite, so downstream consumers can
depend on mechdsl-core for code generation without pulling Taichi into their
dependency closure.
The satellite packages alone¶
pip install algo2code # LaTeX algpseudocode -> executable code; stdlib-only
pip install ti-runtime # Taichi primitives + injection seams for generated code
algo2code never imports mechdsl, and ti-runtime never imports mechdsl either —
generated artifacts depend on ti_runtime, not on the compiler that produced them. Both
are usable standalone.
Install from source¶
Use this if you want the examples/ scripts, the test suite, or you intend to
contribute. The repository is a uv workspace holding all
three monorepo packages.
git clone https://github.com/CEmM2/MechDSL.git
cd MechDSL
uv sync --all-packages --all-groups --all-extras
Verify the install with the fast test tier:
Inside the workspace, always go through uv run
Never call python, pytest, ruff, or mypy directly in a source checkout —
they may not be on your PATH or may pick up the wrong environment. Prefix every
project command with uv run. (This applies to the source workflow only; a
pip installed MechDSL is an ordinary package in whatever environment you put it.)
Command-line entry points¶
mechdsl-core installs one console script:
mechdsl-lawgen --help # emit constitutive-law carriers for the ticonstit target
mechdsl-lawgen compile law.yaml # ...with --dry-run to print the plan and write nothing
mechdsl-workbench installs its own launcher — see the workbench page.
Where to next¶
- mechdsl-core getting started — compile your first solver bundle.
- algo2code getting started — transpile your first algorithm.
- Browser workbench — try the language without writing a script.
- FAQ & troubleshooting — when something doesn't install or run.