Coin_MP unavailable

2,501 views
Skip to first unread message

Aditya

unread,
Jun 26, 2011, 9:32:40 AM6/26/11
to pulp-or-discuss
Hi,

I am using Windows 7 64 bit, Python 2.7.1.
I have tried numerous times installing pulp but I am not getting the
expecting output.

I installed pulp using easy_install -U pulp
The installation was all fine.
Then when I tested my installation here's what I get -


>>> pulp.pulpTestAll()
Solver pulp.solvers.CPLEX_DLL unavailable.
Solver pulp.solvers.CPLEX_CMD unavailable.
Solver pulp.solvers.COIN_CMD unavailable.
Solver pulp.solvers.COINMP_DLL unavailable.
Solver pulp.solvers.GLPK_CMD unavailable.
Solver pulp.solvers.XPRESS unavailable.
Solver pulp.solvers.GUROBI unavailable.
Solver pulp.solvers.PYGLPK unavailable.
>>>

I also tried running a sample program and it gave me the following
error -

Traceback (most recent call last):
File "C:\Users\Aditya\Documents\Downloads\DEA\GAMS
\PuLP-1.4.8\PuLP-1.4.8\examples\WhiskasModel1.py", line 31, in
<module>
prob.solve()
File "C:\Python27\lib\site-packages\pulp-1.4.8-py2.7.egg\pulp
\pulp.py", line 1543, in solve
status = solver.actualSolve(self, **kwargs)
AttributeError: 'NoneType' object has no attribute 'actualSolve'

From what I can understand, the solver isn't being recognized. I also
tried putting "cbc.exe" in the solverdir as mentioned in one of the
threads. But, to be honest, I don't know what exactly does it mean
when Stuart says "Use COIN_CMD"

As one can figure out, I am an absolute noob and if one can help me I
would be extremely grateful.

Also, I will be trying with python 2.6 now.

Thanks a lot.
Aditya

Stuart Mitchell

unread,
Jun 26, 2011, 6:53:04 PM6/26/11
to pulp-or...@googlegroups.com
Did you also post the issue in google code?

the next release will use cbc.exe as its default solver but in the mean time

1. download the file zip file from http://opensolver.org/

2. unpack the zip file and place cbc.exe in a suitable directory
(perhaps c:\cbc\)

3. change the path environment variable to include c:\cbc\ (to test
this open a command prompt and type cbc in
any directory it should start CBC)

4. solve you problems with the non default solver COIN_CMD
>>> prob.solve(COIN_CMD())

hope this works.


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
Freelance Programmer and Optimisation Expert
www.stuartmitchell.com

Aditya

unread,
Jun 27, 2011, 6:11:54 AM6/27/11
to pulp-or-discuss
Thanks Stuart. I haven't tried your version. As per the other post, I
tried using 2.6 and it worked perfectly fine. Being a noob, I would
take it with both hands. :)
Thanks a lot for your advice though.
> > For more options, visit this group athttp://groups.google.com/group/pulp-or-discuss?hl=en.

Aditya

unread,
Jun 27, 2011, 6:12:19 AM6/27/11
to pulp-or-discuss
By the way, I haven't posted it on google code.

On Jun 27, 3:53 am, Stuart Mitchell <s...@stuartmitchell.com> wrote:
> > For more options, visit this group athttp://groups.google.com/group/pulp-or-discuss?hl=en.

Stuart Mitchell

unread,
Nov 6, 2012, 8:23:09 PM11/6/12
to pulp-or...@googlegroups.com
Hello what version of pulp are you using? The latest version (http://pypi.python.org/pypi/PuLP/1.5.3) should work fine with the default solver.

Stu


On Mon, Nov 5, 2012 at 4:42 PM, Danny Whittaker <nemoya...@gmail.com> wrote:
So, I was having this same issue and followed your instructions Stuart, now I get this error:
PulpSolverError: Pulp: cannot execute cbc.exe cwd: \\icsdc00\redirect$\staff\My Documents\***********\My Documents\ICS Scheduling LP

Any ideas?  I'd rather not go back to python 2.6 if possible.  Thanks
To view this discussion on the web visit https://groups.google.com/d/msg/pulp-or-discuss/-/LJ-oRfTgyNUJ.

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

GURKAN

unread,
Jan 15, 2014, 9:13:55 AM1/15/14
to pulp-or...@googlegroups.com
Hello Everyone,

First of all, I've been using pulp on another computer and I find it awesome. So I don't wanna switch to another product. The problem is, I now need to work with another PC.

I am getting the same error (PulpSolverError: Pulp: cannot execute cbc.exe cwd: C:\Users\nediyonbe\Desktop\Kapasite) That's why I post in this thread.
But I also get the following when I test via TestAll():  PulpError: Tests failed for solver <solvers.CPLEX_CMD instance at 0x084E1918>

I am familiar with OR and to an extent Python but not enough to solve problems of this type :S
I use 64bit Windows PC. However, as I have to use different modules I installed 32bit version of Python27 and its modules (numpy, pylab, xlred, pulp etc.). Somewhere I read it's not crucial which was convenient to me as I could not install 64 version of some modules.

 Looking at different forums, I did the following:
1. first I got "no module named pulp error" and dealt with it by explicitly writing the following in my code: sys.path.append('C:\Python27\Lib\site-packages\PuLP-1.5.4-py2.7.egg\pulp')
2. I put the file PuLP-1.5.4-py2.7.egg in "C:\Python27\Lib\site-packages\PuLP-1.5.4-py2.7.egg\pulp"
3. installed cbc.exe from oepnsolver and created a shortcut at C:\Windows\System32
4. i put cbc.exe in the cwd mentioned above.

No hope for now. Any help would be greatly appreciated.

Thank you in advance

Stuart Mitchell

unread,
Jan 15, 2014, 9:08:39 PM1/15/14
to pulp-or...@googlegroups.com
right if you put cbc.exe on the command line path in the system environment variables so that you can run cbc.exe from any directory.

But the best way is probably to use the default solver PULP_CBC_CMD which is packaged with pulp.

If that does not work with you current installation I recommend using easy_install https://pypi.python.org/pypi/setuptools to install pulp i.e. delete the version you put in and run

>easy_install pulp

Stu


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.

GURKAN

unread,
Jan 22, 2014, 2:00:21 AM1/22/14
to pulp-or...@googlegroups.com
Thank you Stuart and sorry for my belatedness. I didn't have access to my computer until yesterday.

I tried with easy install as you said and it worked. Many thanks indeed.

When I execute pulpTestAll() I get the following error though. That must be because I don't have cplex installed. So I don't think I should take that as a real problem. Could you please confirm?

Thank you in advance

Traceback (most recent call last):

  File "<pyshell#24>", line 1, in <module>

    pulp.pulpTestAll()

  File "C:\Python27\lib\site-packages\pulp-1.5.4-py2.7.egg\pulp\pulp.py", line 2235, in pulpTestAll

    pulpTestSolver(s)

  File "C:\Python27\lib\site-packages\pulp-1.5.4-py2.7.egg\pulp\tests.py", line 560, in pulpTestSolver

    t(solver(msg=msg))

  File "C:\Python27\lib\site-packages\pulp-1.5.4-py2.7.egg\pulp\tests.py", line 80, in pulpTest010

    pulpTestCheck(prob, solver, [LpStatusOptimal], {x:4, y:-1, z:6, w:0})

  File "C:\Python27\lib\site-packages\pulp-1.5.4-py2.7.egg\pulp\tests.py", line 22, in pulpTestCheck

    raise PulpError, "Tests failed for solver %s"%solver

PulpError: Tests failed for solver <pulp.solvers.CPLEX_CMD instance at 0x03358558>

Stuart Mitchell

unread,
Jan 22, 2014, 7:23:31 PM1/22/14
to pulp-or...@googlegroups.com
yup but the message should be nicer, I'll have a look

Thanks 
Stu

Ali GÜRKAN

unread,
Jan 28, 2014, 4:10:11 AM1/28/14
to pulp-or...@googlegroups.com
If it will help, I made an exe file with PyInstaller. It works on my PC but gives the error in the screenshot here below when executed on another PC:

 Immagine in linea 1
Then I noticed PyInstaller gave the following, pulp-related warnings while creating the exe file. They still seem normal to me as I didn't install glpk or cplex but I thought it might help.

Thanks again

W: no module named cplex (top-level import by pulp.solvers)
W: no module named odict (conditional import by pulp.pulp)
W: no module named gurobipy (delayed import by pulp.solvers)
W: no module named yaposib (delayed import by pulp.solvers)
W: no module named glpk (delayed import by pulp.solvers)
W: no module named elementtree (delayed, conditional import by pulp.solvers)
W: no module named probstat (delayed import by pulp.pulp)




2014-01-23 Stuart Mitchell <s...@stuartmitchell.com>

--
You received this message because you are subscribed to a topic in the Google Groups "pulp-or-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pulp-or-discuss/KRTyfF1YePA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pulp-or-discu...@googlegroups.com.
Error EXE.jpg

Stuart Mitchell

unread,
Feb 4, 2014, 7:45:58 PM2/4/14
to pulp-or...@googlegroups.com

Looks like pyinstaller did not pick up the default solver CBC.exe

Error EXE.jpg

Ali GÜRKAN

unread,
Feb 10, 2014, 3:10:24 PM2/10/14
to pulp-or...@googlegroups.com
Would it help to call the default solver explicitly instead of prob.solve()? If so, what is the correct syntax for default solver? In other words, we write "prob.solve(pulp.GLPK())" for GLPK, what would be the corresponding notation for default solver cbc?

Thanks
Error EXE.jpg

Stuart Mitchell

unread,
Feb 10, 2014, 8:02:31 PM2/10/14
to pulp-or...@googlegroups.com
>>> prob.solve(pulp.PULP_CBC_CMD())

but I think you will find that pyinstaller has not installed cbc.exe in the solverdir directory

Stu
Error EXE.jpg

Ali GÜRKAN

unread,
Feb 13, 2014, 4:59:50 AM2/13/14
to pulp-or...@googlegroups.com
I tried and didn't work as expected.
It will be a veeeeery basic question but how can I check whether pyinstaller has installed cbc.exe?
Thank You

Stuart Mitchell

unread,
Feb 17, 2014, 5:06:28 PM2/17/14
to pulp-or...@googlegroups.com
see if there is a cbc.exe in the pulp/solverdir  directory where pyinstaller is copying the files.

Stu

shudohmaster

unread,
Oct 20, 2014, 11:58:58 AM10/20/14
to pulp-or...@googlegroups.com
GURKAN - Did you ever get this working?

I am having the same problem and have had no luck so far in finding a solution online.

I checked both the build and dist folders created by pyinstaller and there is no cbc.exe file. Honestly, the only reference I could find to pulp in the directories was in the log file (pasted below).

pulp.solvers: None -> <PyModule 'pulp.solvers' C:\Python27\lib\site-packages\pulp\solvers.pyc imports=[('os', 0, 0, -1), ('warnings', 0, 0, -1), ('stat', 1, 1, -1), ('yaposib', 1, 0, -1), ('time.clock', 0, 0, -1), ('sys', 0, 0, -1), ('ConfigParser', 0, 1, -1), ('xml.etree.ElementTree', 1, 0, -1), ('constants.*', 0, 0, 1), ('ctypes', 1, 0, -1), ('cplex', 0, 0, -1), ('time', 0, 0, -1), ('sparse', 0, 0, 1), ('collections', 0, 0, -1), ('tempfile.mktemp', 0, 0, -1), ('', 0, 0, 1), ('subprocess', 0, 0, -1), ('pulp.__file__', 0, 1, 1), ('constants', 0, 0, 1), ('glpk.glpkpi', 1, 0, -1), ('ctypes', 0, 0, -1), ('configparser', 0, 0, -1), ('pulp', 0, 1, 1), ('gurobipy', 1, 0, -1), ('logging', 0, 0, -1), ('elementtree.ElementTree', 1, 1, -1), ('tempfile', 0, 0, -1)] binaries=[] datas=[]>

Any thoughts on linking pyinstaller and pulp's solvers?

Thanks in advance.

Ali GÜRKAN

unread,
Oct 25, 2014, 5:20:30 AM10/25/14
to pulp-or...@googlegroups.com
Hello shudohmaster,

Sorry for my belatedness. No I couldn''t create an exe file. For the moment I make people install python and run the code there. For non-tech-savvy users it's not a chic way of course but I will go after it again soon. I let you know if I find anything. Please you do the same too.

Good luck!

For more options, visit https://groups.google.com/d/optout.

Stuart Mitchell

unread,
Oct 27, 2014, 5:26:48 PM10/27/14
to pulp-or...@googlegroups.com
I think if you include the cbc binary in the same directory as the zip file that contains your program you can then use the COIN_CMD() solver and give it an explicit path.

Stu

For more options, visit https://groups.google.com/d/optout.

shudohmaster

unread,
Oct 28, 2014, 9:30:52 AM10/28/14
to pulp-or...@googlegroups.com
I got it working. Thanks for the help Stu.

What I did:
1. I downloaded the cbc binary from http://www.coin-or.org/download/binary/Cbc/ and in my case I specifically selected Cbc-2.7.1-win32-mscv9.zip.
2. In my code I added the following:
import os
cwd
= os.getcwd()
solverdir
= 'cbc-2.7.1\\bin\\cbc.exe' # extracted and renamed the binary zip.
solverdir
= os.path.join(cwd, solverdir)
solver
= COIN_CMD(path=solverdir) # I am importing pulp using from pulp import *
prob
.solve(solver)

3. I then ran pyinstaller and dropped the unzipped binary folder (ex. cbc-2.7.1) into the same folder as my executable (inside the dist folder).

Thanks again.

Stuart Mitchell

unread,
Oct 28, 2014, 5:33:37 PM10/28/14
to pulp-or...@googlegroups.com
might be better to use the directory of the file rather than the current directory

os.path.dirname(__file__)

Stu
Reply all
Reply to author
Forward
0 new messages