When running Gurobi through the Python interface, gurobipy, you may receive an error such as:
ModuleNotFoundError: No module named 'gurobipy'
When this happens, it indicates that your Python environment used does not have gurobipy available. Please follow these troubleshooting steps to resolve:
- Ensure that you have installed the Gurobi Python Interface, gurobipy. This is a separate step from installing the Gurobi Optimizer package. To do this, please follow the instructions in How do I install Gurobi for Python? If you would like to walk through a video tutorial, please see How do I resolve common installation issues with the Gurobi Python Interface: gurobipy?
- Check to see if you are using a virtual python environment other than the base. If you are using virtual python environments, ensure you have activated the same environment in which you installed gurobipy.