You can install Gurobi Optimizer for Python in three different ways:
1. pip
Starting with Gurobi 9.1, you can use pip to install Gurobi into your currently active Python environment:
python -m pip install gurobipy
Pip is the standard way of installing Python packages and should work on most platforms and systems. Use this command to install a specific version:
python -m pip install gurobipy==10.0
Note: The pip installation method does not provide Gurobi license tools. If you have not yet set up a license on your machine then you will need to use one of the other installation methods or install the license tools package.
2. conda
If you are using Anaconda Python, you can install Gurobi through Gurobi's conda channel:
conda install -c gurobi gurobi
Use this command to install a specific version:
conda install -c gurobi gurobi=10.0
Note: Gurobi is not available for all Python versions (full list).
3. setup.py
Install the full Gurobi Optimizer package.
- Download and install the full Gurobi installation package from our website.
- In your shell/terminal, navigate to the Gurobi installation folder (GUROBI_HOME) and run:
python setup.py install
Note: If you are using virtual environments, make sure to activate the virtual environment before installing Gurobi.
This table shows the features and differences between the installation methods:
pip | conda | full installer | |
No Windows admin permissions required | ✅ | ✅ | ❌ |
Can use APIs other than Python | ❌ | ❌ | ✅ |
Easy setup for Docker | ✅ | ✅ | ❌ |
Gurobi license tools (grbgetkey, grbprobe) | ❌ | ✅ | ✅ |
Gurobi shell (gurobi.sh or gurobi.bat) | ❌ | ❌ | ✅ |
Gurobi command line tools (gurobi_cl, grbcluster, grbtune, grb_ts) | ❌ | ✅ | ✅ |
Offline installation | ❌ | ❌ | ✅ |
Further information
- Gurobi with Anaconda: Windows, Linux, macOS
- How do I resolve common installation issues with the Gurobi Python Interface: gurobipy?
- How can I set up a license without installing the full Gurobi package?
- How do I resolve the error "UnsatisfiableError" when using conda install?
- How do I resolve the error "Could not open PYTHONSTARTUP"?
- Which Python versions are supported by Gurobi?
- How do I update my Gurobi installation to a newer version?
- How do I use Gurobi with PyCharm?