Installing the Anaconda Python distribution
The Gurobi distribution includes a Python interpreter and a basic set of Python modules. While these are sufficient for building and running simple optimization models, they provide just a glimpse of the wealth of tools and modules that are available for Python. This section guides you through the steps involved in installing Anaconda, a widely-used Python platform that includes an Integrated Development Environment (Spyder), a notebook-style interface (Jupyter), and a broad set of Python modules. These tools can significantly increase the interactivity and productivity of your Python model building experience.
Before we begin, we should note that Anaconda isn't your only choice in Python IDEs. Popular alternatives include Eric, iep, PyCharm, and PyDev. We won't be covering the details of installing these other options for use with Gurobi, but the Anaconda instructions that follow should provide a good outline for the steps involved. We've found that Anaconda provides a nice balance between power and complexity, but we realize that people may look for different things in their Python environments.
You will also find instructions for installing Anaconda Python at the Get Anaconda page on our website.
Step 1: Download and Install Anaconda
The first step is to download and install Anaconda. You can find detailed instructions here. Be sure to check the box Add Anaconda to my PATH environment variable when prompted during the installation process. Otherwise, Step 2 may not work.
Gurobi supports the 64-bit versions of Python 2.7, 3.6, and 3.7. Click on the download button for the version you want. Once the download has been completed, double click on the downloaded .pkg file and follow the installation instructions.
Once the install is complete, and once you close your current terminal and open a new one, typing python in your terminal window should invoke the Anaconda Python interpreter:
Python 3.7.4 |Anaconda, Inc.|...
Type quit() in Python to return to the terminal.
Step 2: Install Gurobi into Anaconda
The next step is to install the Gurobi package into Anaconda. You do
this by first adding the Gurobi channel to your Anaconda channels
and then installing the
gurobi package from this channel.
From a terminal window issue the following command to add the Gurobi channel to your default search list
--add channels http://conda.anaconda.org/gurobi
Now issue the following command to install the Gurobi package
conda install gurobi
You can remove the Gurobi package at any time by issuing the command
conda remove gurobi
Step 3: Install a Gurobi License The third step is to install a Gurobi license (if you haven't already done so).