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 (often already installed if you have MIKE+).

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.

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

TipUsing uv

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:

pip install mikeplus
uv pip install mikeplus
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.

Accessing Model Data

The core of MIKE+Py is the 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:

import mikeplus as mp

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

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:

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)