What is gurobipy?

gurobipy is the Gurobi Python interface. This module allows new users to hit the ground running with convenient, object-oriented modeling constructs and an API to all Gurobi features.  

How do I install Gurobi for Python?

gurobipy offers three installation options: 

  • Pip: Available starting with Gurobi 9.1. This package includes a limited license suitable for solving small problems. 
  • Conda: Anaconda Python users can access Gurobi’s conda channel, though they should ensure they are using the appropriate version. 
  • Offline Installation: For use on machines that do not have internet access.

 

For a full installation guide, check out Gurobi’s Python installation guide. If you prefer videos, be sure to watch this installation video and common installation issues video. 

Which versions of Python are compatible with gurobipy?

Python versions 2.7 and 3.5 through 3.13 are compatible with gurobipy, assuming the user has the appropriate version of Gurobi. It is important to match your version of Python with the appropriate Gurobi release. For a full diagram of Python and Gurobi compatibility, please review the Gurobi version guide. 

Where can I find examples or tutorials for learning gurobipy?

Two things that set Gurobi apart are our customer support services and learning resources. We are continually developing new materials to help new and experienced users alike in developing their skills. Python users who are new to Gurobi or mathematical optimization may want to start with these: 

  • Getting Started with Mathematical Optimization in Python: This blog post summarizes numerous video resources that walk new users through mathematical optimization with gurobipy. Topics include mixed-integer programming, educational resources for students and instructors, and Optimization 101 for data scientists. 
  • Jupyter Notebook Modeling Examples: This library of modeling examples are based on models used on real-life problems. The samples allow your team to adapt the models to your needs and learn as you go. They are categorized by industry type, so you can find examples that are relevant to your field. In addition, the examples increase in complexity, growing your team’s knowledge over time. 
  • Gurobi Optimizer Reference Manual: The Python API Reference section of the manual documents gurobipy in detail. As your skills grow, this reference will give you the detailed information you need to design more complex and nuanced models. 

Does gurobipy support quadratic and nonlinear models?

Yes, gurobipy supports the most common forms of mathematical optimization models, including quadratic and linear models. The Gurobi reference manual section on gurobipy has guidance on both quadratic and nonlinear programming. 

 If you have questions, our Help Center is a great place to get started. Gurobi staff are very active in the community, responding to frequently asked questions in a timely manner. 

How do I integrate gurobipy with Pandas?

gurobipy Pandas is a wrapper library that integrates Gurobi with Pandas. It is ideal for experienced Pandas users who have some familiarity with mathematical optimization. No background in Gurobi is necessary to use this library. 

Is gurobipy compatible with other optimization libraries like PuLP or Pyomo?

We recommend using official Gurobi APIs, as they preserve all functionality, reduce overhead, and are always compatible with the latest Gurobi release. However, we understand that some users need to implement their model with open-source frameworks.  

If you prefer this option, check out our guide for using Gurobi with open-source modeling frameworks, which covers five of the most popular APIs. 

Do I need a commercial license to use gurobipy?

Yes, a commercial license is required to use gurobipy. (However, no license is required to access most of the learning materials mentioned here.) For more information about license options, including a free trial, please review our licensing page. 

Where can I find additional support?

We recommend the following additional resources: 

  • Gurobi Python Package: This package includes a free trial license of Gurobi that allows you to use gurobipy on small optimization problems. 
  • Getting Started with the Gurobi Python API: This tutorial guides users through leveraging gurobipy and the Gurobi Python Matrix API to design and optimize a Mixed Integer Programming model. 
  • Installation Guide: This guide walks users through the three ways to install gurobipy. 
  • Getting Started with the Gurobi Python API Using Dictionaries: This tutorial is for intermediate gurobipy users, as it delves into more complex topics, such as managing the flow of products through large networks. 

Additional Insight

Guidance for Your Journey

30 Day Free Trial for Commercial Users

Start solving your most complex challenges, with the world's fastest, most feature-rich solver.

Always Free for Academics

We make it easy for students, faculty, and researchers to work with mathematical optimization.

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.
Cloud Trial

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

Academic License
Gurobi provides free, full-featured licenses for coursework, teaching, and research at degree-granting academic institutions. Academics can receive guidance and support through our Community Forum.

Search

Gurobi Optimization

Navigation Menu