Could not locate the 'cbc' executable, which is required for solver cbc

9,454 views
Skip to first unread message

Garrett Dowdy

unread,
Nov 26, 2017, 8:45:16 PM11/26/17
to Pyomo Forum
Hello Pyomo community,

I'm trying to get up and running with Pyomo on a 64-bit Windows machine, and I'm having some difficulty.

Specifically, I'm trying to solve the attached concrete model by using the following command in a Jupyter notebook:

!pyomo solve concreteProblem.py --solver cbc

When I do so, I get the following error message:

[    0.00] Setting up Pyomo environment
[    0.00] Applying Pyomo preprocessing actions
[    0.00] Creating model
[    0.00] Applying solver
WARNING
: "[base]\site-packages\pyomo\solvers\plugins\solvers\CBCplugin.py", 189, _default_executable
       
Could not locate the 'cbc' executable, which is required for solver cbc
[    0.00] Pyomo Finished
ERROR
: Unexpected exception while running model:
       
No executable found for solver 'cbc'

So it seems that I don't have Cbc properly installed. Here's what I did in an effort to install it:
  1. I found the brief instructions given in Section 10.2 of the Pyomo Installation Guide.  
  2. These instructions pointed me to the Cbc Wiki, which, in turn, pointed me to the COIN Optimization Suite, referencing a "Windows Installer".  
  3. On this latter site, I couldn't find anything that was obviously an "installler".  There were only two downloads clearly intended for 64-bit Windows machines.  I downloaded the one titled "CoinAll-1.6.0-win64-intel11.1" hoping that I'd find a "Windows installer" inside.  However, if it's there, I couldn't find it.
  4. I placed the "CoinAll-1.6.0-win64-intel11.1" directory in my "C:\Program Files\" directory.
  5. Remembering what was said in the Pyomo Installation Guide, I tried to add the "cbc.exe" file contained in the "CoinAll-1.6.0-win64-intel11.1" directory to my PATH.  To do this, I went to Computer --> System Properties --> Advanced system settings --> Advanced --> Environment Variables.  I then added the variable "cbc" with the variable value "C:\Program Files\COIN\CoinAll-1.6.0-win64-intel11.1\bin" as both a user variable and system variable.
Clearly this wasn't enough.  What do I need to do appropriately install Cbc for use with Pyomo?

I apologize for my ignorance.  Any you can give me help would be appreciated.

Garrett
concreteProblem.py

Garrett Dowdy

unread,
Nov 27, 2017, 8:02:33 AM11/27/17
to pyomo...@googlegroups.com
Update: I get the same error message when I try to call Pyomo directly from the command line using

pyomo solve concreteProblem.py --solver cbc

Garrett

Siirola, John D

unread,
Nov 27, 2017, 12:09:05 PM11/27/17
to pyomo...@googlegroups.com

CBC is included as part of the COIN-OR Optimization Suite.  Windows builds can be downloaded here: https://www.coin-or.org/download/binary/OptimizationSuite/.  You will want one of the “.EXE” files (those are the installers).

 

You cannot move the cbc.exe file relative to the other files because the executable will not be able to find the necessary DLLs.

 

For Pyomo: Pyomo needs CBC to be available through the system PATH.  There is an option to have the installer do this for you.  You may need to reboot your computer after the install for the PATH change to take effect.  You can test this by opening up a command prompt and running “cbc” and see if you get a “Coin:” prompt.  If that works, then CBC is installed correctly and Pyomo should be able to find it.

 

john

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Garrett Dowdy

unread,
Nov 27, 2017, 9:13:06 PM11/27/17
to pyomo...@googlegroups.com
Thanks for your help, John!

I'm working on a 64-bit Windows machine.  However, looking at the list of executables at the site you recommended, it seems that they are all for 32-bit Windows... Are any of these good for 64-bit Windows?

Siirola, John D

unread,
Nov 28, 2017, 1:35:44 AM11/28/17
to pyomo...@googlegroups.com

Yes.  You can run 32-bit executables in 64-bit Windows.

 

john

 

From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com] On Behalf Of Garrett Dowdy
Sent: Monday, November 27, 2017 7:13 PM
To: Pyomo Forum <pyomo...@googlegroups.com>

--

Garrett Dowdy

unread,
Nov 28, 2017, 8:37:39 PM11/28/17
to Pyomo Forum
It worked!  Thank you, John!

Giorgio Balestrieri

unread,
Feb 19, 2019, 11:42:28 AM2/19/19
to Pyomo Forum
It might be a weird requirement, but for specific applications I prefer downloading CBC without the whole coin-or suite (through http://ampl.com/dl/open/cbc/cbc-win64.zip, for instance), and it doesn't seem to work with Pyomo. Or better, if I put the cbc.exe executable (there are not DLLs in the folder it comes in) on my path, it doesn't work. I have to explicitly specify the executable for the solver, and then it works, which is not great. Is it possible that when SolverFactory is called with 'cbc' it does not look for a bare cbc.exe file?

Wei Wan

unread,
May 26, 2024, 10:54:29 PMMay 26
to Pyomo Forum
"For Pyomo: Pyomo needs CBC to be available through the system PATH.  There is an option to have the installer do this for you.  You may need to reboot your computer after the install for the PATH change to take effect.  You can test this by opening up a command prompt and running “cbc” and see if you get a “Coin:” prompt.  If that works, then CBC is installed correctly and Pyomo should be able to find it."

I have installed cbc since I have tested this by getting a "Coin" prompt as what you advised above. 
However, when I run solver=pyomo.opt.SolverFactory("cbc.exe"),
I got the following error message: 

ValueError: Failed to set executable for solver asl. File with name=cbc.exe either does not exist or it is not executable. To skip this validation, call set_executable with validate=False.

It looks like that CBC is not available through the system PATH for Pyomo. Pyomo cannot find it. 
Thank you for any advice. 

Siirola, John

unread,
May 28, 2024, 10:39:08 AMMay 28
to pyomo...@googlegroups.com

There are two things:

 

  1. First, make sure you have imported pyomo.environ somewhere before trying to create a solver with the SolverFactory (that ensures that the solver plugins all get registered with the SolverFactory).
  2. The correct name for the CBC solver interface is “cbc” (not “cbc.exe”)

 

John

 

 

From: pyomo...@googlegroups.com <pyomo...@googlegroups.com> On Behalf Of Wei Wan
Sent: Sunday, May 26, 2024 4:22 PM
To: Pyomo Forum <pyomo...@googlegroups.com>

Subject: Re: [EXTERNAL] Re: Could not locate the 'cbc' executable, which is required for solver cbc

 

You don't often get email from wanw...@gmail.com. Learn why this is important

Wei Wan

unread,
May 28, 2024, 11:17:44 AMMay 28
to pyomo...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages