Unable to call Gurobi Solver from PuLP

1,656 views
Skip to first unread message

Akul Bansal

unread,
Sep 2, 2018, 7:26:30 PM9/2/18
to pulp-or-discuss
I am using PuLP (version 1.6.8) on a Windows 10 64bit machine through Spyder (Anaconda) compiler. I have recently installed free academic licence of Gurobi and trying to call the gurobi solver from Pulp interface. On doing so I get the following error 

PermissionError: [WinError 5] Access is denied

These are following things I am doing and have tried to resolve the issue. I am a novice and everything below is hit and trial. 

1.  Called the gurobi solver in PuLP with command prob.solve(GUROBI_CMD("C:\gurobi801\win64"))
2. Ran Spyder with administrator permissions.
3. Reinstalled the gurobi licence file into different folders
4. Set path variable GRB_LICENSE_FILE with value C:\gurobi801\win64\gurobi.lic
5. Gave all read/write permissions to the gurobi folder
6. Installed general version of Python 3.7 (was only using spyder before)
7. Tried running the command prob.solve(GUROBI("C:\gurobi801\win64"))
8. Ran the command pulp.pulpTestAll and found GUROBI_CMD passed and rest were unavialable
9. Tried running following commands
#SS = solvers.GUROBI_CMD("C:\gurobi801\win64")
#SS.actualSolve(prob)
but still got same error
10. Changed path to  C:\gurobi801\ in above commands
11. Checked by running gurobi shell that license was running and installed

I basically want to have warm starts for MIPs thats why I want Gurobi. Any help would be appreciated.

Regards, Akul



Stuart Mitchell

unread,
Sep 2, 2018, 7:29:19 PM9/2/18
to pulp-or...@googlegroups.com

--
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To post to this group, send email to pulp-or...@googlegroups.com.
Visit this group at https://groups.google.com/group/pulp-or-discuss.
For more options, visit https://groups.google.com/d/optout.

Akul Bansal

unread,
Sep 3, 2018, 1:29:28 PM9/3/18
to pulp-or-discuss
Dear Stuart,

Thanks for replying back. I have separately downloaded gurobipy through anaconda prompt very similar to what is suggested on the page you shared. A few more things that I have tried are :
1. Putting the gurobi folder (including licence file) in the same folder where I have all my python files
2. Installing gurobi in D Drive

I am still getting the same error !
Are there any alternatives to warm starting while still using PuLP interface ? I don't want to rewrite everything again.

Akul Bansal

unread,
Sep 4, 2018, 5:43:36 AM9/4/18
to pulp-or-discuss
A small update, I have identified warm starts are different from giving an initial solution and CBC does allow setting up an initial solution. I haven't implemented this yet but more details can be found here 

Warm starts make more sense in the LP setting where the solver picks up the basic feasible solution given in warm start and sometimes also the inverse. 

Stuart Mitchell

unread,
Sep 4, 2018, 8:02:16 PM9/4/18
to pulp-or...@googlegroups.com
from your python file can you do 

import gurobipy

if you can do this you can access the gurobi solver from python and in pulp the GUROBI() solver class should work

if not you need to follow the instructions on the gurobi website

Stu

Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru

To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pulp-or-discuss@googlegroups.com.

Akul Bansal

unread,
Sep 5, 2018, 4:54:25 AM9/5/18
to pulp-or-discuss
I am able to import gurobipy but I am passing the solver as GUROBI_CMD. When I do pulp.pulpTestAll this is the solver that comes "passed". Actually trying passing the solver GUROBI worked !! Thanks a lot. This is surprising as same thing was not working before!
Reply all
Reply to author
Forward
0 new messages