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 distributions and/or IDEs. Popular alternatives include Canopy, 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.

Image anaconda_mac

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 2.7.15 |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

conda config --add channels

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).

You are now ready to use Gurobi from within Anaconda. Your next step is to launch either the Spyder IDE or Jupyter.


Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.