1.1. Local Installation#

These instructions are optional. Most students will be okay using Google Colab for the entire semester.

1.1.1. Install anaconda#

Anaconda is a Python distribution that supports the conda package manager and environments. Follow these steps if you do not have anaconda or miniconda already installed:

1.1.2. Create a new conda environment#

conda envirorments allow us to maintain several difference Python installations on our computer. This allows for easy switching between Python versions or different versions of Python packages. Using an environment will ensure anything we install for this class does not disrupt your other Python workflows.

After installing conda, run this command in the terminal:

conda create --name spring2021 python=3.8

This creates an environment called spring2021. Next we need to activate it:

conda activate spring2021

Whenever you open a new terminal, you will likely need to activate our new environment.

1.1.3. Install IDAES-PSE#

The IDAES-PSE toolset (Institute for the Design of Advanced Energy Systems - Process Systems Engineering) is an open-source framework for multiscale process modeling, optimization, and advanced analytics. The IDAES toolset is built on top of Pyomo. We’ll mainly use Pyomo in this class, although we’ll highlight a few IDAES capabilities.

To install idaes, run:

 conda install -c idaes-pse -c conda-forge idaes-pse

This command will install idaes as well as all of its dependencies, including pyomo.

After conda finishes, run:

idaes --version

To verify idaes is installed in your active environment.

1.1.4. Install Ipopt#

Windows and Linux users - you are in luck. IDAES comes with a nonlinear optimization solver Ipopt compiled with the HSL linear algebra routines; I may refer to this as “good Ipopt”. Later in the semester, we’ll talk about why the linear alegbra library is important. To install the “good Ipopt”, run:

idaes get-extensions

Linux users: you may need to install some dependencies too: https://idaes-pse.readthedocs.io/en/stable/getting_started/index.html#linux

This will install Ipopt in a hidden user folder. If you get the error WARNING: Could not locate the 'ipopt' executable add the line import idaes to the top of your notebook then restart the Python kernel. Our library helper takes care of adding Ipopt to the system path on Colab. If you use the instructions below, “okay” Ipopt will be installed.

macOS users - unfortunately, IDAES does not include binaries for “good Ipopt”. You can either compile the solver yourself after obtaining an academic license for HSL or you can install the “okay Ipopt” using conda:

conda install -c conda-forge ipopt

1.1.5. Install Additional Solvers#

In additional to ipopt, we will also use glpk. To install it, run:

conda install -c conda-forge glpk

You may also wish to install other commercial solvers, especially if you want to consider large mixed integer optimization problems for research. These solvers offer free academic licenses:

1.1.6. Install Notebook Spellcheker#

Here is a great Jupyter extension that adds a spellchecker to your notebooks. To install, run the following commands in the terminal (in your new conda environment):

conda install -c conda-forge jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextension enable spellchecker/main