Python, Anaconda, Gurobi, and Pyomo Installation

1. Installing Python with Anaconda (Recomended)

  • Anaconda installation is not necessary but it is the easiest way to manage environments and packages with a user friendly interface, it also comes with preinstalled useful libraries (pip, NumPy, Pandas, etc.). If you don’t want to install Anaconda, you can jump to the last section “Python and pip Individual Install

  • To install Anaconda visit Anaconda Download, and install with the predetermined defaults. In this case the installation is for “Just Me” and using the predetermined destination folder.

  • Make sure to select " :white_check_mark: Add Anaconda3 to my PATH environment variable " and " :white_check_mark: Register Anaconda3 as my default Python 3.8 "

2. Install a Python Solver

  • Gurobi can be installed as a solver for the Python programming language with the installation of Gurobipy. Other solvers can also be used.

  • Download the Gurobi optimizer for your system from the Gurobi Academia page.

  • Run the installation wizard for Gurobi and select default location installation.

  • Make sure you are connected to an academic network or vpn and request an Academic License from Gurobi, a code in the form grbgetkey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx should be generated

  • Open Gurobi Interactive Shell and a license code should be requested corresponding the the code after grbgetkey, being xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx. Interactive Shell will close automatically.

  • Gurobipy now can be installed by opening the Anaconda Prompt and adding the Gurobi channel to install Gurobipy using the following commands.

(base) C:\Users\YourUser>conda config --add channels https://conda.anaconda.org
(base) C:\Users\YourUser>conda install gurobi

3. Install Pyomo for Optimization

  • Pyomo is a great tool for MIP and optimization, to install Pyomo open the Anaconda Prompt and type the following line and proceed with the installation: “conda install -c conda-forge pyomo
(base) C:\Users\YourUser>conda install -c conda-forge pyomo

4. Done

  • Now your favorite Python IDE can be installed to start writing Python code.

- Python and pip Individual Install

  • Python can be downloaded from the official site. In this case Python 3.9.5 was installed in Windows 10 device.

  • In the installation wizard check the box " :white_check_mark: Add Python 3.9.5 to PATH " and select customize installation.

  • Make sure the " :white_check_mark: pip " and " :white_check_mark: py launcher " checkboxes are selected, pip will allow packages installation in the future and py will allow calling Python from the command prompt, keep others as defaults. Click Next

  • Select " :white_check_mark: Install for all users " and click Install.

  • To ensure the installation, open Command Prompt as administrator to run the command “Python --version”, this should retrieve the installed Python version.

C:\Windows\system32>Python --version
Python 3.9.5
1 Like