Skip to content

Environment and prerequisites

Choose the environment that will execute your workflow. The Python library and the CLI share model APIs, but their installed packages need not be the same.

WorkflowEnvironment to prepareNext step
Python scripts or notebooksAn isolated Python 3.11–3.13 environment.Install the library.
r2x pipelinesThe runtime managed by r2x-cli.Install the CLI plugin.

Confirm that the interpreter you intend to use is supported:

Terminal window
python --version

If this reports an unsupported version, select an installed Python 3.11, 3.12, or 3.13 interpreter before creating the environment. Create a virtual environment in your project directory:

Terminal window
python -m venv .venv

Activate it on macOS/Linux:

Terminal window
source .venv/bin/activate

Or activate it in Windows PowerShell:

Terminal window
.venv\Scripts\Activate.ps1

Confirm where Python is running before installing packages:

Terminal window
python -c "import sys; print(sys.executable)"

The path should point inside this .venv. For notebooks, select the corresponding kernel so imports and package installation use the same interpreter.

Install uv and the r2x-cli binary. Confirm the executable is available:

Terminal window
r2x --version

Prepare the Python runtime required by that CLI binary:

Terminal window
r2x python install

Inspect its actual version and environment path:

Terminal window
r2x python show

The CLI binary’s Python ABI must match its managed runtime. The tutorials were executed with CLI 0.1.15 and its Python 3.12 runtime. Changing a project virtual environment does not change the binary’s ABI; see CLI runtime guidance if startup reports an ABI mismatch.

You do not need study data to verify installation. The tutorial downloads pinned public fixture data using curl and explains its companion files. It needs network access and a new working directory. XML parsing does not need a licensed PLEXOS solver; running an optimization is a separate workflow.