Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Gurobi in python 3?

Tags:

python

gurobi

I tried to install the gurobi package on python 3 but it didn't work. The command that i am using on my macbook is: pip install gurobipy, but it doesn't work, it shows me this:

ERROR: Could not find a version that satisfies the requirement gurobipy (from versions: none) ERROR: No matching distribution found for gurobipy`

like image 770
M.HANHASSE Avatar asked Sep 05 '25 17:09

M.HANHASSE


2 Answers

On macOS gurobipy is automatically installed in the system's python installation. If you need to install it within another python installation or virtual environment, too, then you need to install gurobipy like described at the end of this section in the quickstart guide. It boils down to going to the installation directory of Gurobi, and running an installer script:

(venv) bash-3.2$ cd /Library/gurobi811/mac64/
(venv) bash-3.2$ python setup.py install
like image 151
Robert Avatar answered Sep 07 '25 06:09

Robert


fyi for pip installs:

  1. use the following command for python 3.0+

python -m pip install -i https://pypi.gurobi.com gurobipy

  1. obtain the relevant license and activate using grbgetkey (have to download gurobi install files from website to access grbgetkey as that's not installed using pip

  2. copy the gurobi.lic file wherever you initially installed it to the following directory: [your python dir]/site-packages/gurobipy/.libs **note there is an existing restricted install license in the directory, simply replace it.

Restart the kernel for python and the new license will be activated. No idea why Gurobi hasn't already published this info on their website for python pip installations.

like image 30
mathcomp guy Avatar answered Sep 07 '25 08:09

mathcomp guy