On my Windows 10 system, Gurobi is installed correctly, license installed and the environmental variable set up as in the quick start guide. The following cmd transcript sums it up quite nicely.
Everything seems to be in order ...
C:\Users\User1>gurobi
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Academic license - for non-commercial use only
Gurobi Interactive Shell (win64), Version 8.0.0
Copyright (c) 2018, Gurobi Optimization, LLC
Type "help()" for help
gurobi>However ...
C:\Users\User1>python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gurobipy
Traceback (most recent call last): File "<stdin>", line 1, in <module>
ImportError: No module named gurobipyWhy is this happening and how can I resolve it?
1 Answer
Why is this happening and how can I resolve it?
You apparently have two separate versions of Python 2.x installed on your system (Python 2.7.8 and Python 2.7.15). Each of these installations is treated separately. You seem to have Gurobi associated with Python 2.7.8 (not Python 2.7.15).
Reading through the documentation you linked, Gurobi comes with an interpreter (Python 2.7.8 I am assuming). However, you need to install the Gurobi Python interface in your command line version of Python (e.g. Python 2.7.15).
Based on the official Gurobi documentation, it seems Gurobi may have the necessary setup files for this interface in its installation directory somewhere. You will need to look for setup.py, open a command window in that same directory and then run python setup.py install from the command line in order to install the interface correctly.
As a small note, the latest version of Python 2.x is Python 2.7.16.
2