Setup.py script is not working, Windows 10, Python 3.7.4, Gurobi 8.1.1
AnsweredEdit: I worked around this by installing anaconda's python 3.7. Not sure why this worked, but it did!
So I've been struggling with this a few hours. I have used Gurobi on Linux/Mac before-- but I just got a desktop running Windows and was excited to break it in with some ILPs.
I installed Python 3.7.4, and then installed Gurobi 8.1.1 and activated my license key.
I primarily use the Python interface, so I went ahead and ran the setup.py install script. The output indicates that it worked.
C:\gurobi811\win64>python setup.py install
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\gurobipy
copying python37\lib\gurobipy\__init__.py -> build\lib\gurobipy
copying python37\lib\gurobipy\gurobipy.pyd -> build\lib\gurobipy
running install_lib
running install_egg_info
Removing C:\Users\12096\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\gurobipy-8.1.1-py3.7.egg-info
Writing C:\Users\12096\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\gurobipy-8.1.1-py3.7.egg-info
removing C:\gurobi811\win64\build
However, when I run Python and attempt to import gurobipy, I get an error.
C:\gurobi811\win64>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gurobipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\12096\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.
Please help. I've looked at similar issues reported. Generally, it seems like if I get this Import Error, then I didn't run the setup.py install script, but I did run the script and I'm still getting the error.
Thank you!!!
-
I have also tried running the setup script,
C:\gurobi811\win64\bin\pysetup
by passing in my python path, but this didn't resolve my issue either.
Python installation directory (hit ENTER to use c:\Python27): C:\Users\12096\AppData\Local\Programs\Python\Python37-32
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\gurobipy
copying python37\lib\gurobipy\__init__.py -> build\lib\gurobipy
copying python37\lib\gurobipy\gurobipy.pyd -> build\lib\gurobipy
running install_lib
running install_egg_info
Removing C:\Users\12096\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\gurobipy-8.1.1-py3.7.egg-info
Writing C:\Users\12096\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\gurobipy-8.1.1-py3.7.egg-info
removing C:\gurobi811\win64\build
[Hit ENTER to exit]Again, when I run my python shell, I fail to import gurobipy.
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from gurobipy import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\12096\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.0 -
Hi Matt - It looks like your default Python is a 32-bit version:
C:\Users\12096\AppData\Local\Programs\Python\Python37-32\lib
Gurobi 8.x works only with 64-bit Python installations. Can you try using a different Python?
Thanks.
0 -
Thanks Gwyneth!
0
Please sign in to leave a comment.
Comments
3 comments