Installing Pyomo
Pyomo is a Python wrapper around various solvers written in other languages. As such, you install Pyomo along with a solver to use it. In this course, we will use the open-source HiGHS solver from the University of Edinburgh.
Often, students end up with multiple Python installations on their computer, which can lead to confusion. The easiest way to avoid this is to use Miniconda or Anaconda to manage your Python installation. If you already have Python installed, you can try installing Pyomo and HiGHS using pip, but if you run into issues, I recommend uninstalling your existing Python installation(s) and installing Miniconda instead.
(For those of you who are more experienced programmers, I recommend looking at uv as an extremely fast and effective Python package manager. Though it requires some comfort with the command line.)
Installation via Conda (existing install)
If you have installed Python via Miniconda or Anaconda, then you can install the required packages directly with conda.
From a terminal (Windows start menu → Terminal), run
conda install -c conda-forge pyomo highsTo install Pyomo and the HiGHS solvers. If the command is not found, you might need to run this command from an Anaconda command line (it might be an option on your start menu).
Installation via Conda (new install)
Download and install Miniconda. Since this is a new installation, you will need to install various packages. I recommend running the following from a terminal (Windows start menu → Terminal) to install common packages:
conda install -c conda-forge scipy numpy matplotlib ipython pyomo highsIf the command is not found, it means that conda is not on your system path (i.e., the list of folders that Windows searches for programs to run). If you installed Miniconda in the default place, you should be able to change to the installation folder and run the command from there:
cd \Users\Your Username\AppData\Local\miniconda3\Scripts
conda install -c conda-forge scipy numpy matplotlib ipython pyomo highsor (on some installs)
cd \Users\Your Username\miniconda3\Scripts
conda install -c conda-forge scipy numpy matplotlib ipython pyomo highsIf you use PyCharm, Spyder, or VS Code, you will need to change the Python interpreter they use to the new one.
- PyCharm instructions
- Spyder instructions - see “How do I get Spyder to work with my existing Python packages/environment”
- VS Code instructions
Installing via Pip
If you can install Pyomo and HiGHS using pip:
pip install pyomo highspyIf you have installed Python using Anaconda (or Miniconda), it is recommended to use conda instead of pip to avoid conflicts between packages.
Using Google Colab
If you have a Google account, you have free access to Colab. This provides a notebook-style interface to cloud-based computers with Python already installed. Simply create a new notebook in Colab and add these lines to the top of the notebook:
!pip install pyomo highspyThese commands need to be run each time you re-open the notebook, but they only need to be run once per session. As such, it is best to keep them in a cell that is separate from the rest of your work at the top of the notebook.
HiGHS also has an example notebook on Google Colab.