Python Kernel dies every time I run Gurobi code on Anaconda

1,136 views
Skip to first unread message

fernando...@uas.edu.mx

unread,
Nov 9, 2017, 3:03:56 PM11/9/17
to Gurobi Optimization
Hi everyone,

I have a problem, when I execute my Gurobi code on Anaconda (using Spyder 3.2.3), the Kernel dies. Any clue?

This is the error:

runfile('/Users/drfernando/Downloads/Food1.py', wdir='/Users/drfernando/Downloads')

Kernel died, restarting




Thanks,

Fernando

fernando...@uas.edu.mx

unread,
Nov 9, 2017, 3:52:07 PM11/9/17
to Gurobi Optimization
This is the print screen, in fact I have used one of the code example provided by Gurobi (Food manufacture I), to discard any error of coding.
Captura de pantalla 2017-11-09 a la(s) 13.13.56.png

Michael Winkler

unread,
Nov 9, 2017, 6:00:36 PM11/9/17
to Gurobi Optimization
Hi Fernando,

my guess is that you have an Anaconda 5 (with what I can see a python 3.6). For this Anaconda version with together with a python 3.6 this is very likely a bug in Anaconda python on Mac. Sorry about that, as a work around you could use an earlier version of Anaconda or switch to Anaconda with python 2.7.

Best,
Michael

fernando...@uas.edu.mx

unread,
Nov 10, 2017, 12:47:18 AM11/10/17
to Gurobi Optimization
Hi Michael,

Thanks a lot, You were right. I had python 3.6, so I changed to python 3.5 doing the following:

conda install python=3.5.0
and it works. Thanks again for your help.

Best regards,

Fernando

Fernando Briones

unread,
Apr 25, 2018, 4:08:26 AM4/25/18
to Gurobi Optimization
Hi Fernando,

Im experiencing the same trouble as you but when I write down in the terminal the code conda install python=3.5.0
 I have an error message... Could you please tell me which anaconda did you have, which python and which gurobi??? 
Thanks in advance,

Fernando 

Tobias Achterberg

unread,
Apr 25, 2018, 4:11:28 AM4/25/18
to gur...@googlegroups.com
We found the reason for the Gurobi/Anaconda issue on Mac. It should be fixed in the 8.0.0
release that you can download from our website.

Best regards,

Tobias

GurobiUser

unread,
Apr 25, 2018, 8:14:54 AM4/25/18
to Gurobi Optimization
Hi Tobias,

I am using Gurobi 7.5.2 version with anaconda python 2.7 on Ubuntu 16.04 but now I want to switch to anaconda with python 3.6 version. For this I tried to remove gurobi first and then try to install again with anaconda python 3.6 but is not working, still gurobi run with python 2.7.

Should I unistall gurobi firstand then install again with anaconda python 3.6? If yes, what command to use to uninstall gurobi on ubuntu 16.04?

Thanks in advance for your help.

Tobias Achterberg

unread,
Apr 25, 2018, 11:10:53 AM4/25/18
to gur...@googlegroups.com
Are you using a Mac? In this case, you should upgrade to Gurobi 8.0.

I think that it could be that uninstalling from Anaconda has some issues. So it
may be that you have to uninstall Anaconda and install it freshly.


Tobias

GurobiUser

unread,
Apr 26, 2018, 6:08:35 AM4/26/18
to Gurobi Optimization
Hi Tobias,

Thank for your quick reply. I am using Linux, Ubuntu 16.04 version. Actually I uninstalled anaconda for python 2.7 and installed anaconda for python 3.6 for Linux but when I try to install Gurobi into anaconda as it is stated here, step two, (http://www.gurobi.com/downloads/get-anaconda), it gives me this warning:

Warning: 'http://conda.anaconda.org/gurobi' already in 'channels' list, moving to the top

And then when I install Gurobi package with the command: conda install gurobi it does not change the default Gurobi python 2.7.

So my question is to how now change the distributed Gurobi python 2.7 to Python 3.6 version?

Thanks again,

Kostja Siefen

unread,
Apr 26, 2018, 8:35:45 AM4/26/18
to Gurobi Optimization
Hi,

This does not seem to be an Gurobi issue. Anaconda allows you to create multiple environments with different Python versions (see https://conda.io/docs/user-guide/tasks/manage-environments.html).
You need to activate the environment first (e.g. "source activate [envname]" on Linux). Then you can use "conda install gurobi" to install the correct package.

Kostja

GurobiUser

unread,
Apr 27, 2018, 1:04:56 AM4/27/18
to Gurobi Optimization
Hi Kostja,

Many thanks for your answer. I tried to create the environments as you suggested but without success(the terminal does not know the commands).

Is there a better/faster way to change the distributed Gurobi python version from 2.7 to 3.6? I tried even this: http://www.gurobi.com/documentation/7.5/quickstart_mac/the_gurobi_python_interfac.html

but still does not work...

Thank you!

Kostja Siefen

unread,
Apr 27, 2018, 4:45:42 AM4/27/18
to Gurobi Optimization
It is hard to guess what the underlying problem is from your description. The following works perfectly on my machine:

1) Add the channel for the Gurobi conda package: conda config --add channels http://conda.anaconda.org/gurobi
2) Create a new environment (e.g. with name "py36") with Python 3.6 and Gurobi 8.0.0: conda create -n py36 python=3.6 gurobi=8.0.0 anaconda 
3) Activate the new environment ("py36"): activate py36 (or "source activate py36" on Linux/Mac)
4) Run Python: python

You need to "activate" the environment every time before running Python. This sets up environment variables.

Kostja

GurobiUser

unread,
Apr 27, 2018, 6:18:59 AM4/27/18
to Gurobi Optimization
Thank you so much Kostja. Now works perfectly. And you are right, I was little bit confused...but now everything is clear to me.

Best regards,
Reply all
Reply to author
Forward
0 new messages