Installation

Installing BendersLib

Tip

If you are new to Python, we recommend using conda as your package and environment manager. By default, conda will install pip in the created environments, so you can use either pip or conda to install BendersLib (and other packages).

BendersLib was written in pure Python, you can easily install it via pip or conda.

Environment Setup (optional)

To avoid potential dependency conflicts, it is recommended to create a new conda environment for BendersLib before installing it.

# Create a new conda environment named "bendersenv" with Python 3.9 or higher
conda create -n bendersenv python=3.9

# Activate the new environment
conda activate bendersenv

Installing BendersLib

Caution

BendersLib requires Python 3.10 or higher.

python --version
# Should be Python 3.10 or higher

pip install benderslib

# Upgrade to the latest version
pip install benderslib --upgrade
# Install from PyPI using uv
uv pip install benderslib

# Upgrade to the latest version
uv pip install --upgrade benderslib

Verifying the Installation

To verify that BendersLib has been installed correctly, you can run the following code:

import benderslib as bd

print("BendersLib version:", bd.__version__)

If you see the version number printed without any errors, the installation was successful.

Installing Solvers

# Install only needed solvers

pip install "benderslib[copt]"
pip install "benderslib[cplex]"
pip install "benderslib[cplexcp]"
pip install "benderslib[gurobi]"
pip install "benderslib[ortools]"
pip install "benderslib[pyomo]"
pip install "benderslib[scip]"
# Install all supported solvers

pip install "benderslib[all-solvers]"

Attention

BendersLib will NOT install any solver to your environment automatically. You need to install the solvers separately based on your needs.

BendersLib supports several popular optimization solvers. You can install these solvers individually based on your needs. Installing all of them is not necessary. Please refer to Supported Solvers’ Features for solver features and license requirements

Installing Solvers

Solver

pip

conda

Guide

COPT

pip install coptpy

N/A

Install

CPLEX

pip install cplex

conda install ibmdecisionoptimization::cplex

Install [1]

CP Optimizer

pip install docplex

conda install ibmdecisionoptimization::docplex

Install [1]

Gurobi

pip install gurobipy

conda install gurobi::gurobi

Install

OR-Tools

pip install ortools

N/A

Install

SCIP

pip install pyscipopt

conda install conda-forge::pyscipopt

Install

Pyomo [2]:

pip install pyomo

conda install conda-forge::pyomo

Install

CBC

N/A

conda install conda-forge::coincbc

Install

CPLEX

pip install cplex

conda install ibmdecisionoptimization::cplex

Install

GLPK

N/A

conda install conda-forge::glpk

Install

Gurobi

pip install gurobipy

conda install gurobi::gurobi

Install

HiGHS

pip install highspy

conda install conda-forge::highspy

Install

MOSEK

pip install mosek

conda install mosek::MOSEK

Install

SCIP

N/A

conda install conda-forge::scip

Install

Xpress

pip install xpress

conda install fico-xpress::xpress

Install

Troubleshooting

To be added (common issues will be summarized here)…