You can install Gurobi Optimizer for Python in two ways:
- Install the full version of Gurobi Optimizer:
- Download Gurobi from the website and install it.
- In your shell/terminal, go to Gurobi's installation folder (GUROBI_HOME) and run
python setup.py installNote: If you are using virtual environments, make sure to activate the virtual environment before installing Gurobi.
- If you are using Anaconda Python, you can install Gurobi through Gurobi's conda channel by running:
conda install -c gurobi gurobi
Both methods provide access to Gurobi (including gurobi_cl). There are reasons why one may be preferable to the other.
When to use the full installation
There are several reasons why you would use the full installation through the website; note that these are not mutually exclusive:
- You are using Gurobi in a language other than Python.
- You would like to have access to the Gurobi shell (gurobi.sh).
- You are not using (or do not want to use) Anaconda.
- you are using a version of Python that is not supported by the current Gurobi release.
When to use the conda package
Reasons to use the conda package which only works with Python:
- You are only using Gurobi in Python (and no other programming language) and are already using or willing to use Anaconda.
- You want to build a Docker image using Python and Gurobi. While it is not strictly necessary to use the conda package, the package installation is easier to use in the Dockerfile and the pipeline.
- You are using Windows and do not have administrator privileges.
- Gurobi with Anaconda: Windows, Linux, macOS
- 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?