Installation of PuLP and Solver on Mac OS X

3,057 views
Skip to first unread message

Vishal

unread,
May 26, 2012, 3:16:02 PM5/26/12
to pulp-or-discuss
Hello All,

I am new to PuLP and newish to python. Please excuse any novice
questions.

I would like to install PuLP on a machine running Mac OS X 10.7.3
using python 2.6.7. This machine already has gurobi 5.0 installed to
it (which runs correctly). Ideally, I would like the PuLP
installation to be able to call both Gurobi and the CoinOR solvers.

At the moment, I've installed PuLP using pip:
$ pip install pulp

which executes (seemingly correctly).

However, when I run the pulpTests, I get a number of errors,
presumably because something is wrong with the installation. (Output
below). Does the standard installation come with pre-built binaries
for the coin-or solvers? if not, how can I get these, or else, how
can I configure pulp to call Gurobi directly?

Thanks in advance for any advice or guidance. Output from the
pulpTests is below.

Vishal


>>> import pulp
>>> pulp.pulpTestAll()
Testing zero subtraction
Testing continuous LP solution
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/pulp.py", line 2227, in pulpTestAll
pulpTestSolver(s)
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/tests.py", line 558, in pulpTestSolver
t(solver(msg=msg))
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/tests.py", line 80, in pulpTest010
pulpTestCheck(prob, solver, [LpStatusOptimal], {x:4, y:-1, z:6, w:
0})
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/tests.py", line 15, in pulpTestCheck
status = prob.solve(solver, **kwargs)
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/pulp.py", line 1606, in solve
status = solver.actualSolve(self, **kwargs)
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/solvers.py", line 1227, in actualSolve
return self.solve_CBC(lp, **kwargs)
File "/Users/VGupta/Documents/PythonScripts/research/lib/python2.6/
site-packages/pulp/solvers.py", line 1284, in solve_CBC
stderr = pipe)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

Stuart Mitchell

unread,
May 27, 2012, 5:18:17 PM5/27/12
to pulp-or...@googlegroups.com
yes the cbc solver provided doesn't work with OS X (I would love someone to compile cbc for OS X)

Unfortunately, It looks like the pulpTestAll() code does not pick this up. However, try solving one of the example problems with gurobi

>>> prob.solve(GUROBI())

and it should work ok provided gurobi is installed properly

Stu


--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To post to this group, send email to pulp-or...@googlegroups.com.
To unsubscribe from this group, send email to pulp-or-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pulp-or-discuss?hl=en.




--
Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru

Vishal Gupta

unread,
Jun 20, 2012, 10:43:11 AM6/20/12
to pulp-or...@googlegroups.com
Hi Stu,

Sorry I got back to you so late on this.

The installation does seem to correctly work if I pass 'GUROBI()' explicitly.

Is there a way I can change the default solver so that it defaults to Gurobi?  Maybe in one of the const files?

VG

Stuart Mitchell

unread,
Jun 20, 2012, 7:34:23 PM6/20/12
to pulp-or...@googlegroups.com
Sorry does not seem to be an easy way to do this

but if you find this code in pulp.py


# Default solver selection
if PULP_CBC_CMD().available():
    LpSolverDefault = PULP_CBC_CMD()
elif GLPK_CMD().available():
    LpSolverDefault = GLPK_CMD()
elif COIN_CMD().available():
    LpSolverDefault = COIN_CMD()
else:
    LpSolverDefault = None


add 

LpSolverDefault = GUROBI()

To the bottom

I'll see if I can fix this in the next revision.

Stu

Stuart Mitchell

unread,
Jan 7, 2013, 4:42:42 AM1/7/13
to pulp-or...@googlegroups.com
sorry thought you had included the executables in this post, so was waiting to i had time to add the feature.

Please compile them and I will add them.


Stu


On Mon, Nov 26, 2012 at 2:55 PM, Noli Sicad <nsi...@gmail.com> wrote:
Hi Stu,


On Monday, 28 May 2012 07:18:17 UTC+10, Stuart Mitchell wrote:
yes the cbc solver provided doesn't work with OS X (I would love someone to compile cbc for OS X)

I compiled CBC 2.7.8 solver for Mac OS X (10.8.2) and CoinMP (dynamic library ( i.e. libCoinMP.0.0.0.dylib)  for Mac OS X.

I like to help Pulp runs in Mac OS X.

I can compile CBC and libCoinMP for x32 and x64 for Mac OS X so Pulp can run in all Mac OS X.

Regards,

Noli

 

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pulp-or-discuss/-/YabhoEmtijIJ.

To post to this group, send email to pulp-or...@googlegroups.com.
To unsubscribe from this group, send email to pulp-or-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pulp-or-discuss?hl=en.

Stuart Mitchell

unread,
Jan 7, 2013, 4:53:08 AM1/7/13
to pulp-or...@googlegroups.com
sorry found the files on google code issue

Stu
Reply all
Reply to author
Forward
0 new messages