# Getting started

This guide will help you get started with MIKE+Py, from installation to running your first operations.


# Requirements

- A licensed installation of MIKE+ 2026. Each MIKE+Py release line targets one MIKE+ year; for MIKE+ 2025, install `mikeplus==2025.*`.
- Python (x64) 3.12 or later, on Windows.
- [VC++ redistributables](https://aka.ms/vs/17/release/vc_redist.x64.exe) (often already installed if you have MIKE+).

> **Note: Linux**
>
> Linux isn't supported yet. MIKE+Py can be imported on Linux x64, but parts of MIKE+ itself, such as database operations, don't work there yet.
>
> To try it anyway, install the .NET 8 runtime and set the `MIKEPLUSPY_INSTALL_ROOT` environment variable to the MIKE+ install root (the parent folder of `bin`). If MIKE+ native libraries fail to load, also add `$MIKEPLUSPY_INSTALL_ROOT/bin/x64` to `LD_LIBRARY_PATH` before starting Python; it can't be changed from within a running process.

> **Important: Import Conflicts with `mikeio` and `mikeio1d`**
>
> Due to underlying library dependencies, `mikeplus` currently has known conflicts:
>
> - `mikeio1d` **must** be imported *after* `mikeplus`; otherwise importing `mikeplus` raises an `ImportError`.
> - `mikeio` is not fully supported in the same Python process as `mikeplus`. `mikeplus` warns when both are loaded; import `mikeio` *before* `mikeplus`, or use separate processes if you run into problems.
>
> Please plan your scripts accordingly. The environment variable `MIKEPLUSPY_DISABLE_CONFLICT_CHECKS=true` can be set to bypass these checks at your own risk.


# Installation

> **Tip: Using uv**
>
> [uv](https://docs.astral.sh/uv/) is an extremely fast Python package and project manager that is 10-100x faster than pip, and makes it easy to install Python and manage projects. With uv, creating a virtual environment is as easy as `uv venv`.

To install MIKE+Py, run this command in your terminal:


- <a href="" id="tabset-1-1-tab" class="nav-link active" data-bs-toggle="tab" data-bs-target="#tabset-1-1" role="tab" aria-controls="tabset-1-1" aria-selected="true">pip</a>
- <a href="" id="tabset-1-2-tab" class="nav-link" data-bs-toggle="tab" data-bs-target="#tabset-1-2" role="tab" aria-controls="tabset-1-2" aria-selected="false">uv</a>


``` bash
pip install mikeplus
```


``` bash
uv pip install mikeplus
```


> **Note: Note**
>
> The Python package is named `mikeplus` (for `import mikeplus`) and is installed from PyPI using `pip install mikeplus`. The development repository is named `mikepluspy`.


# <img src="data:image/svg+xml;base64,PHN2ZyBzdHlsZT0iaGVpZ2h0OjFlbTt3aWR0aDoxZW07dmVydGljYWwtYWxpZ246LTAuMTI1ZW07Zm9udC1zaXplOmluaGVyaXQ7b3ZlcmZsb3c6dmlzaWJsZTtwb3NpdGlvbjpyZWxhdGl2ZTsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld2JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLSBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJnZC1pY29uIiBhcmlhLWhpZGRlbj0idHJ1ZSI+PHBhdGggZD0iTTEyIDN2MTgiIC8+PHJlY3QgeD0iMyIgeT0iMyIgcng9IjIiIC8+PHBhdGggZD0iTTMgOWgxOCIgLz48cGF0aCBkPSJNMyAxNWgxOCIgLz48L3N2Zz4=" class="gd-icon" /> Accessing Model Data

The core of MIKE+Py is the [Database](../reference/Database.md#mikeplus.Database) object, which provides an interface to your MIKE+ model. You can open a model, access its tables, and query data.

Here's how to open a database and read a table into a pandas DataFrame:

``` python
import mikeplus as mp

with mp.open("your_model_project.sqlite") as db:
    db.tables.msm_Node.select().to_pandas()
```


# <img src="data:image/svg+xml;base64,PHN2ZyBzdHlsZT0iaGVpZ2h0OjFlbTt3aWR0aDoxZW07dmVydGljYWwtYWxpZ246LTAuMTI1ZW07Zm9udC1zaXplOmluaGVyaXQ7b3ZlcmZsb3c6dmlzaWJsZTtwb3NpdGlvbjpyZWxhdGl2ZTsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld2JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLSBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJnZC1pY29uIiBhcmlhLWhpZGRlbj0idHJ1ZSI+PHBhdGggZD0iTTUgNWEyIDIgMCAwIDEgMy4wMDgtMS43MjhsMTEuOTk3IDYuOTk4YTIgMiAwIDAgMSAuMDAzIDMuNDU4bC0xMiA3QTIgMiAwIDAgMSA1IDE5eiIgLz48L3N2Zz4=" class="gd-icon" /> Running a Simulation

MIKE+Py allows you to execute simulations defined in your MIKE+ model directly from Python.

This example runs the currently active simulation in the model:

``` python
import mikeplus as mp

with mp.open("your_model_project.sqlite") as db:
    print(f"Running simulation: {db.active_simulation} for model type: {db.active_model}")
    
    # Run the active simulation
    result_files = db.run()
    
    print("Simulation finished. Result files:")
    for res_file in result_files:
        print(res_file)
```
