Skip to content

Installation

optimex is available on PyPI and conda. Choose your preferred package manager below. In case you have an Apple Silicon Chip, you can directly jump to the platform-specific notes.

Quick Install

If you just want to get started quickly:

uv pip install optimex
pip install optimex
conda install -c conda-forge -c cmutel -c diepers optimex

Detailed Installation

Using uv

uv is a fast, modern Python package manager written in Rust. It's significantly faster than pip and handles dependency resolution more reliably. Installing uv is a one-liner.

Create a new project with uv:

uv init my-optimex-project
cd my-optimex-project
uv add optimex

Run your scripts with:

uv run python my_script.py

Or directly get started in JupyterLab:

uv run --with jupyter jupyter lab

By default, juypter lab will start the server at http://localhost:8888/lab.

One-line optimex setup

For your convenience, we've prepared a setup script that initiates a new uv project and fetches our optimex example notebook, so you can directly get started. Just run:

uv run https://raw.githubusercontent.com/RWTH-LTT/optimex/refs/heads/main/scripts/uv_setup.py my-optimex-example
You can of course customize the project name, just replace the "my-optimex-example" at the end.

Create and activate a new virtual environment:

uv venv .venv
source .venv/bin/activate  # Linux/macOS
# or: .venv\Scripts\activate  # Windows

Install optimex:

uv pip install optimex

If you already have an activated virtual environment:

uv pip install optimex

Using conda / mamba

Conda and mamba are popular in scientific computing. Mamba is a faster drop-in replacement for conda.

Create a new environment with optimex:

conda create -n optimex -c conda-forge -c cmutel -c diepers optimex
conda activate optimex

Or with mamba:

mamba create -n optimex -c conda-forge -c cmutel -c diepers optimex
mamba activate optimex

Activate your environment and install:

conda activate myenv
conda install -c conda-forge -c cmutel -c diepers optimex

Using pip

The standard Python package manager.

Create and activate a virtual environment:

python -m venv .venv
source .venv/bin/activate  # Linux/macOS
# or: .venv\Scripts\activate  # Windows

Install optimex:

pip install optimex

If you already have an activated virtual environment:

pip install optimex

Platform-Specific Notes

Apple Silicon (M1/M2/M3/M4)

Brightway and optimex run natively on Apple Silicon. However, the standard pypardiso solver used on Windows and Linux is not compatible with ARM processors. To achieve fast linear algebra calculations, you must use scikit-umfpack.

uv manages your Python environment efficiently, but you must first install the system-level SuiteSparse dependencies via Homebrew.

Install system dependencies:

brew install swig suite-sparse

Create project & add dependencies:

uv init my-project
cd my-project
# Adding optimex along with the ARM-compatible solver
uv add optimex scikit-umfpack

Run Jupyter (without adding to project)

uv run --with jupyter jupyter lab

When using pip, you must first install the system-level SuiteSparse dependencies via Homebrew.

Install system dependencies:

brew install swig suite-sparse

Install packages:

# Ensure your virtual environment is activated
pip install optimex scikit-umfpack

Conda is the most robust method for Apple Silicon because it handles the complex C-libraries (SuiteSparse) automatically without requiring Homebrew.

conda create -n optimex -c conda-forge -c cmutel -c diepers \
    optimex \
    "scikit-umfpack>=0.4.2" \
    "numpy>=2"

conda activate optimex

Optional Dependencies

Jupyter Support

For interactive notebooks:

uv pip install jupyterlab
pip install jupyterlab
conda install -c conda-forge jupyterlab

Development Installation

To install from source for development:

git clone https://github.com/TimoDiepers/optimex.git
cd optimex
pip install -e ".[dev,docs]"

Verifying Installation

Test that optimex is installed correctly:

import optimex
print(optimex.__version__)

Solver Requirements

optimex uses Pyomo for optimization, which requires a solver. By default, it uses Gurobi, but you can configure other solvers like GLPK, CBC, or HiGHS.

Gurobi License

Gurobi offers free academic licenses. Visit gurobi.com to obtain one.