Gurobi/Python Use for Mac OS 10.6

575 views
Skip to first unread message

Emily Frost

unread,
Mar 8, 2012, 7:18:23 PM3/8/12
to Gurobi Optimization
Hello all,

I am a new user of Gurobi, with a MacBook Pro running OS 10.6 as my
primary research computer. I would like to use Gurobi as my primary
optimizing software, but I would like to utilize it through the Gurobi/
Python interface. I'm having trouble importing .py files into the
optimizer -- I get an ImportError, which from reading other message
boards seems to be from the intersection of Gurobi, Python 2.7, and
Mac OS X. I've tried resetting/overwriting my version of Python with
version 2.6, but have been unsuccessful so far.

Ideal solution: step-by-step instructions on initializing the Gurobi-
Python interface for OS X, including code for importing a .py file
into the optimizer.

Thanks so much!

Best,
Emily Frost

Greg Glockner

unread,
Mar 8, 2012, 7:35:29 PM3/8/12
to gur...@googlegroups.com
On Mac or Linux, you can always run a .py file as follows:

gurobi.sh myprogram.py

On Windows, simply change .sh to .bat:

gurobi.bat myprogram.py

Additionally, for Mac OS X, gurobi.sh is just a small wrapper around /usr/bin/python2.6, so gurobi.sh myprogram.py is equivalent to:

python2.6 myprogram.py


The full answer:

On Mac OS X, we only support the version of Python that is supplied by Apple. This means two things:

1. We don't support another version of Python, such as a version downloaded from python.org
2. We support Python 2.6 but not (yet) Python 2.7 since 2.7 was not supplied with Snow Leopard

Additionally, for Mac OS X, the installer automatically installs the gurobipy module for Python 2.6; there is no need to run setup for Mac OS X.

Greg Glockner

unread,
Jan 11, 2013, 11:48:40 AM1/11/13
to gur...@googlegroups.com
> I noticed in the recent release of Gurobi 5.1 that there is now support for Python2.7 on Mac OS X.

Correct.



> Is this limited again to the Apple - version of python at:
> /usr/bin/python2.7 ?

Yes.



> I understand that currently this is the only version of Python supported by Gurobi, but are there any plans to support other versions? (For example, the one at python.org? Or, a 32-bit version of python?)

No plans for Mac OS X, but there is more flexibility for Windows and Linux.



> Also, where is the best place to check WITHIN the Gurobi Documentation to monitor which version python is currently supported by Gurobi on Mac OSX?

We're supporting the version of Python that is distributed with OS X. We were stuck with Python 2.6 while we were supporting Snow Leopard (OS X 10.6), and we were able to upgrade to Python 2.7 with Gurobi Optimizer 5.1, which does not support Snow Leopard.

Reply all
Reply to author
Forward
0 new messages