This is only for Gurobi 9.0.1.
- Windows, Python 3.8.1 from http://www.python.org
- after running python setup.py install, importing gurobipy fails with this error
from .gurobipy import * ImportError: DLL load failed while importing gurobipy: The specified module could not be found.
You need to tell Python how to find the library again. This can be done either by
- copying the gurobi90.dll from C:\gurobi901\win64\bin\ to PYTHON_INSTALLATION_PATH\lib\site-packages\gurobipy\ or by
- specifying how the library can be found within the current Python environment:
import os os.add_dll_directory(os.path.join(os.getenv('GUROBI_HOME'), 'bin'))
Note that in the second case, this has to be done every time before import gurobipy, while the first solution is permanent.
There is a new Windows safety feature that changes how DLLs are loaded in Python 3.8 and that affects the installation of Gurobi.
We are going to integrate this into the distribution for future releases.