Reputation: 163
I have installed Gurobi on my Windows 10 machine and I'm trying to use it in Python. Trying to import import gurobipy
yields the following error:
Traceback (most recent call last):
File "C:\Users\me\test.py", line 4, in <module>
import gurobipy
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gurobipy\__init__.py", line 1, in <module>
from .gurobipy import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
Running gurobi
from the command line works fine.
What does ImportError: DLL load failed: %1 is not a valid Win32 application.
mean?
Upvotes: 1
Views: 908
Reputation: 595
Looking at your trace I see
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\
which suggests that you are using a 32 bit build of Python 3.7. However current Gurobi distributions only ship with a gurobipy
Python extension compiled for 64 bit Python versions. You need to use a 64 bit Python build to use the gurobipy
extension.
Upvotes: 2