Gurobi: Difference between revisions

Jump to navigation Jump to search
349 bytes added ,  6 months ago
m
no edit summary
No edit summary
mNo edit summary
Line 138: Line 138:


<!--T:91-->
<!--T:91-->
Gurobi brings it's own version of Python which does not contain any 3rd-party Python packages except Gurobi.  In order to use Gurobi together with popular Python  
Gurobi brings it's own version of Python which does not contain any 3rd-party Python packages except Gurobi.  In order to use Gurobi together with popular Python packages like NumPy, Matplotlib, Pandas and others, we need to create a [[Python#Creating_and_using_a_virtual_environment|virtual Python environment]] in which we can install both <code>gurobipy</code> and for example <code>pandas</code>. Before we start, we need to decide which combination of versions for Gurobi and Python to use.  A listing of the Python version(s) supported by the major gurobi versions installed in the previous through current standard environments (StdEnv) follows:
packages like NumPy, Matplotlib, Pandas and others, we need to create a [[Python#Creating_and_using_a_virtual_environment|virtual Python environment]] in which we can install both <code>gurobipy</code> and e.g. <code>pandas</code>.  
 
<!--T:214-->
Before we start, we need to decide which combination of versions for Gurobi and Python to use.  For example compare the Python versions supported by the Gurobi 8.11 and 9.0.1 modules:


<!--T:201-->
<!--T:201-->
{{Commands|prompt=[name@server ~] $
[name@server ~] module load StdEnv/2016; module load gurobi/8.1.1; cd $EBROOTGUROBI/lib; ls -d python*
|module load StdEnv/2016 (not needed for gurobi>9.0.2)
python2.7 python2.7_utf16  python2.7_utf32  python3.5_utf32  python3.6_utf32 python3.7_utf32
|module load gurobi/8.1.1  
 
|cd $EBROOTGUROBI/lib  
[name@server ~] module load StdEnv/2020; module load gurobi/9.5.2; cd $EBROOTGUROBI/lib; ls -d python*
|ls -d python*
python2.7_utf16  python2.7_utf32  python3.10_utf32  python3.7  python3.7_utf32  python3.8_utf32  python3.9_utf32
  python2.7       python2.7_utf32    python2.7_utf16
  python3.5_utf32  python3.6_utf32   python3.7_utf32
[name@server ~] module load StdEnv/2023; module load gurobi/10.0.3; cd $EBROOTGUROBI/lib; ls -d python*
}}
python3.10_utf32  python3.11_utf32 python3.python3.7_utf32 python3.8_utf32  python3.9_utf32
{{Commands|prompt=[name@server ~] $
|module load StdEnv/2016  (not needed for gurobi>9.0.2)
[name@server ~] module load StdEnv/2023; module load gurobi/11.0.1; cd $EBROOTGUROBI/lib; ls -d python*
|module load gurobi/9.0.1
  python3.11
|cd $EBROOTGUROBI/lib  
|ls -d python*
  python3.7        python2.7_utf16 python2.7_utf32
  python3.5_utf32 python3.8_utf32  python3.6_utf32 python3.7_utf32
}}


<!--T:95-->
<!--T:95-->
We see that <code>gurobi/8.1.1</code> brings its own installation of <code>python2.7</code> and Python packages for Python 2.7, 3.5, 3.6 and 3.7 (<code>pythonX.Y_utf32</code>) while <code>gurobi/9.0.1</code> by default uses <code>python3.7</code> and brings Python packages for Python 2.7, 3.5, 3.6, 3.7 and 3.8 (<code>pythonX.Y_utf32</code>).
We see that <code>gurobi/8.1.1</code> brings its own installation of <code>python2.7</code> and Python packages for Python 2.7, 3.5, 3.6 and 3.7 (<code>pythonX.Y_utf32</code>) while <code>gurobi/9.0.1</code> by default uses <code>python3.7</code> and brings Python packages for Python 2.7, 3.5, 3.6, 3.7 and 3.8 (<code>pythonX.Y_utf32</code>).  While <code>gurobi/11.0.1</code> by comparison only brings Python <code>3.11</code> along.


=== Creating the virtual environment === <!--T:10-->
=== Creating the virtual environment === <!--T:10-->
cc_staff
1,857

edits

Navigation menu