"no module named gurobipy" on Jupyter with Python 2, but works with Python 3

2,399 views
Skip to first unread message

alel...@gmail.com

unread,
Aug 12, 2018, 8:39:55 AM8/12/18
to Gurobi Optimization
Hi!

I am quite new to Python, so my question might be naïve, but this is the situation:

I have been using Gurobi with Python 3 on Anaconda's Jupyter for a while without a problem. 
However, for a specific assignment, I was required to use Python 2, so I changed the kernel on Jupyter, but now every time I run "from gurobipy import *" I get the ImportError "no module named gurobipy". How can I make Python 2 access it?

Thank you

zinc...@gurobi.com

unread,
Aug 12, 2018, 8:47:00 AM8/12/18
to Gurobi Optimization
You will need to install Gurobi API for that Python distro, see


Please note that with 8.0 release, gurobipy can be used with Python 2.7, 3.5, or 3.6 on Mac OS.

Alex Laval

unread,
Aug 12, 2018, 9:22:17 AM8/12/18
to gur...@googlegroups.com
Hi! 
Thank you for your answer. I have already read that page, but it still does not work. When I run the command "python setup.py install" I get the following error:

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory


What surprises me is that the moment that, on the same Jupyter notebook, I change the kernel to Python 3, I am able to use Gurobi. But if I change it back to Python 2, I don't.

--

---
You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

zinc...@gurobi.com

unread,
Aug 13, 2018, 3:29:00 AM8/13/18
to Gurobi Optimization
you may want to 'cd' to the directory where Gurobi's setup.py is; the console shows the script cannot be found
Reply all
Reply to author
Forward
0 new messages