Gurobi: Difference between revisions

Jump to navigation Jump to search
60 bytes added ,  5 months ago
m
no edit summary
mNo edit summary
mNo edit summary
Line 206: Line 206:
| source ~/env_gurobi/bin/activate
| source ~/env_gurobi/bin/activate
}}
}}
As before, install any needed Python packages (in this case <code>pandas</code>) for example:
As before, install any needed Python packages.  Since the following matrix example requires <code>numpy</code> we install the pandas package :


<!--T:110-->
<!--T:110-->
Line 212: Line 212:
|  pip install --no-index  pandas
|  pip install --no-index  pandas
}}
}}
Next install gurobipy into the environment. As mentioned above and in [[https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python|this article]] the use of setup.py to install Gurobi for python is deprecated starting with Gurobi 11.  Both pip and conda are given as alternatives, however since conda should not be used on alliance systems, the pip approach will be demonstrated here.
Next install gurobipy into the environment. As mentioned above and in [[https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python|this article]] the use of setup.py to install Gurobi for python is deprecated starting with Gurobi 11.  Both pip and conda are given as alternatives, however since conda should not be used on alliance systems, the pip approach will be demonstrated here. The installation of gurobipy is slightly complicated since Alliance linux systems are setup with gentoo prefix.  As a result neither A) the recommended command to download and install the gurobipy extension from the public PyPI server <code>pip install gurobipy==11.0.1</code> mentioned in the article line or B) the offline command to install the wheel with <code>python -m pip install --find-links <wheel-dir> --no-index gurobipy</code>, will work.  Instead a script available from the alliance maybe utilized to download and simultaneously convert the existing wheel into an usable format with a new name.  There is one caveat, for each new Gurobi version the researcher must go into https://pypi.org/project/gurobipy/11.0.1/#history and click on the desired version followed by the <code>Download files</code> button located in the left hand menu.  Finally click to copy the https link for the wheel file (named gurobipy-11.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl in the case of Gurobi 11.0.1) and paste it as the --url argument as shown below :
 
The installation is slightly complicated since Alliance linux systems are setup with gentoo prefix.  As a result neither A) the recommended command to download and install the gurobipy extension from the public PyPI server <code>pip install gurobipy==11.0.1</code> mentioned in the article line or B) the offline command to install the wheel with <code>python -m pip install --find-links <wheel-dir> --no-index gurobipy</code>, will work.  Instead a script available from the alliance maybe utilized to download and simultaneously convert the existing wheel into an usable format with a new name.  There is one caveat, for each new Gurobi version the researcher must go into https://pypi.org/project/gurobipy/11.0.1/#history and click on the desired version followed by the <code>Download files</code> button located in the left hand menu.  Finally click to copy the https link for the wheel file (named gurobipy-11.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl in the case of Gurobi 11.0.1) and paste it as the --url argument as shown below :


<!--T:112-->
<!--T:112-->
cc_staff
1,857

edits

Navigation menu