1

I am trying to solve an optimization problem in pyomo by using ipopt as solver. My OS is ubuntu. However I am getting the following error"

pyomo.common.errors.ApplicationError: No executable found for solver 'ipopt'

I tried the solution mentioned here, namely I did the following:

sudo apt-get install gcc g++ gfortran git cmake liblapack-dev pkg-config --install-recommends

and

sudo apt-get install coinor-libipopt-dev

But I still getting the same error. Any idea of how can I bypass it?

Kosmylo
  • 436
  • 1
  • 6
  • 20
  • I’m voting to close this question because it is not a programming question. It appears to be an Ubuntu software installation problem, so it should be asked on the AskUbuntu site – Stephen C Aug 13 '22 at 08:54
  • There exist at least 5 similar questions, which have the same question, but different characteristics and they are not closed. – Kosmylo Aug 13 '22 at 08:58
  • https://stackoverflow.com/a/73911876/3614578 – gary69 Sep 30 '22 at 19:35

1 Answers1

3

first things first...

After installing, did you log out COMPLETELY or restart your computer to register the new environment variables upon re-login?

In a terminal window you should be able to type:

>which ipopt

And get a path back to the registered executable (or a symbolic link). This is the executable that python/pyomo is calling to solve the optimization. If you get "not found" or such, then it isn't installed properly and you need to go back to the coin-or site and look for instructions.

If it is installed, you should finally verify that it is "callable" from the same command prompt. It should look similar to this:

>ipopt

No stub!
usage: ipopt [options] stub [-AMPL] [<assignment> ...]

Options:
    --  {end of options}
    -=  {show name= possibilities}
    -?  {show usage}
    -bf {read boundsfile f}
    -e  {suppress echoing of assignments}
    -of {write .sol file to file f}
    -s  {write .sol file (without -AMPL)}
    -v  {just show version}

If you know where it is installed or you can search and find the executable, navigate to that folder (it is likely inside the version numbered folder) and the bin (binaries) folder under the version number. Then try to run the executable from there with the ipopt command. If that works, you know the install location and you could:

  • unpdate your environment variables to include that. (I'm not versed on Unbuntu) but this can be screwed up and cause big problems if you don't know what you are doing.
  • copy that path and simply provide that path in pyomo when you ask the solver factory for the solver and provide the path reference. On my machine that would be this location where Homebrew installs a symbolic link:

solver = SolverFactory('ipopt', executable='/usr/local/bin/ipopt')

If none of this gets you anywhere, you might want to use Homebrew to install it (instead of apt-get) ... Instructions are on the coin-or site I believe and I think that is all compatible with Ubuntu.

AirSquid
  • 10,214
  • 2
  • 7
  • 31
  • 1
    It only worked for me when I added `executable='/usr/local/bin/ipopt'` even though `ipopt` was in my PATH – gary69 Sep 30 '22 at 16:50