How to import gurobi 5.0 in python3.2?

1,613 views
Skip to first unread message

jiho yoon

unread,
Jun 11, 2012, 10:16:31 PM6/11/12
to Gurobi Optimization
Hi,

I am trying to import gurobi 5.0 (32bits) in python3.2 by using

from gurobipy import *

but it does not work... is 5.0 working in python3.2?

Greg Glockner

unread,
Jun 11, 2012, 10:25:16 PM6/11/12
to gur...@googlegroups.com
Python3 is not supported.

Jiho Yoon

unread,
Jun 11, 2012, 11:21:38 PM6/11/12
to gur...@googlegroups.com
Now I'm re install python 2.7.3 for 64 bits. but it still does not work...What should I do for using Gurobi??

On Mon, Jun 11, 2012 at 10:25 PM, Greg Glockner <gloc...@gurobi.com> wrote:
Python3 is not supported.




--

Jiho Yoon
PhD Graduate Student
Department of Supply Chain Management
The Eli Broad Graduate School of Management
N468 North Business Complex
Michigan State University
East Lansing, MI 48824-1121
(e) yo...@bus.msu.edu

Greg Glockner

unread,
Jun 11, 2012, 11:30:51 PM6/11/12
to gur...@googlegroups.com
> Now I'm re install python 2.7.3 for 64 bits. but it still does not work...What should I do for using Gurobi??

It is not necessary to install your own copy of Python - one is provided with the Gurobi software.

If you are a Python expert and you want to install gurobipy into your own (supported) Python distribution, search the Gurobi website for setup.py, which will explain how to do it.

Jiho Yoon

unread,
Jun 12, 2012, 12:08:28 AM6/12/12
to gur...@googlegroups.com
I'm so sorry to bother you...but it does not work even I just followed the instruction.

Is it possible to use gurobi 5.0 in python 2.7.3?

As I know I cannot download 2.7.2 now.

Because the Gurobi is goint to be used as a extension of my python code, I need to it in the python.  

Please let me know how to load Gurobi in python 2.7.3

Thank you

Greg Glockner

unread,
Jun 12, 2012, 8:57:41 AM6/12/12
to gur...@googlegroups.com
> I'm so sorry to bother you...but it does not work even I just followed the instruction.

It's known to work. You'll have to be more specific about what steps you followed and the output you received.

Jonas Malaco Filho

unread,
Jun 12, 2012, 9:02:30 AM6/12/12
to gur...@googlegroups.com
It should be something like:
cd /opt/gurobi500/linux64
sudo python2.7 setup.py install

If I remember correctly setup.py uses the current working dir (or I had something wrong in my path, don't really remember, but you can just read setup.py and check it). Also, you usually need to be a super user (linux) or in a command prompt ran as administrator (win vista/7). 

Jonas Malaco Filho

Jonas Malaco Filho

unread,
Jun 12, 2012, 9:08:31 AM6/12/12
to gur...@googlegroups.com
Also make sure you run it with the desired python binary. If you have too many python binaries in your path, you can assign some (different) symbolic links to them. 

Jonas Malaco Filho

On 12/06/2012, at 09:57, Greg Glockner <gloc...@gurobi.com> wrote:

Greg Glockner

unread,
Jun 19, 2012, 8:42:14 PM6/19/12
to gur...@googlegroups.com
For Mac OS X, Gurobi Optimizer 5.0.0 supports Python 2.6. Python 2.7 is supported for Windows and Linux.

The reason is that Apple did not support Python 2.7 for Snow Leopard. When we drop Snow Leopard support, we will support Python 2.7 for Mac.

In the meantime, I'm afraid that your options are to use another platform or to use Python 2.6.

Greg Glockner

unread,
Jun 20, 2012, 5:00:41 PM6/20/12
to gur...@googlegroups.com
> Any idea on when OSX Lion will become supported?

OS X Lion is already supported. We're just not supporting Python 2.7 on it.

I don't have a date when we will drop Snow Leopard support and therefore support Python 2.7 on OS X.

Greg Glockner

unread,
Jun 22, 2012, 12:02:24 PM6/22/12
to gur...@googlegroups.com
> Well, does this mean that I cannot use Python 3.2 and Gurobi 5 on Mac OS Lion?

We don't support Python 3.x on Mac OS X Lion or on any other platforms.


> If so, what is the solution? Installing Python 2.6, and using Gurobi 5?

There's nothing to install for Mac OS X. Gurobi integrates with Python 2.6 that comes with Mac OS X (ex: in /usr/bin/python2.6 for Lion).

Greg Glockner

unread,
Jun 22, 2012, 3:31:26 PM6/22/12
to gur...@googlegroups.com
In terminal, run the command:

/usr/bin/idle2.6

In IDLE, write:

from gurobipy import *

Ed Rothberg

unread,
Dec 6, 2012, 9:08:40 PM12/6/12
to gur...@googlegroups.com

I'd suggest that you browse the Java examples...



Mitesh Khadgi

unread,
Dec 7, 2012, 1:37:10 AM12/7/12
to gur...@googlegroups.com
Hi,

Thanks for the info Rothberg.
In all the java examples, import gurobi.* is used.
From where can I get the gurobi.jar file?

Greg Glockner

unread,
Dec 7, 2012, 9:12:26 AM12/7/12
to gur...@googlegroups.com
> From where can I get the gurobi.jar file?

In the lib subdirectory.

The rest of your initial setup questions can be answered by studying the Makefile (Linux/Mac) or the runjava.bat file (Windows) in the examples\build subdirectory.

Reply all
Reply to author
Forward
0 new messages