Skip to content

Gurobi

A state-of-the-art software solver for mathematical optimization.


Gurobi requires an environment module

In order to use Gurobi, you must first load the appropriate environment module:

module load gurobi

Loading Gurobi#

To use Gurobi on the HPC system, load the module:

$ module load gurobi

Python Usage#

Gurobi can be used in Python via the gurobipy package. It is recommended to install this using uv.

On a RCC terminal run:

1
2
3
4
5
$ conda deactivate
$ module load webproxy
$ module load python-uv
$ uv venv gurobienv --python 3.11
$ source gurobienv/bin/activate

Warning

Python 3.11 is required for compatibility with the Gurobi installation on the HPC.

Install the gurobipy and (if needed) jupyterlab packages:

(gurobienv) $ uv pip install gurobipy jupyterlab

Using Gurobi in Jupyter Notebooks (OOD)#

To use gurobipy in Jupyter Notebooks via Open OnDemand:

Create a Jupyter session by selecting "Interactive Sessions" then "Jupyter Notebooks" from the dropdown menu.

  • Select python-uv/latest for the "Python version (required)".
  • Select "UV Virtual Environment" for the "Type of Environment Jupyter is installed in".
  • Enter your Python environment name (in our example: gurobienv).
  • Ensure "Internet Access via Web Proxy" is enabled.
  • Click "Launch".

Warning

The webproxy module must be enabled or Gurobi solvers may fail to load.

Note

You must create your environment in the terminal before launching the Jupyter session in OOD.