I'm using Kali Linux and I needed to install ipopt to use with pyomo in Python which I'm currently learning. I have tried several things and none of them have worked with trying to run ipopt in pyomo. First, following their official website's instructions did not work (https://coin-or.github.io/Ipopt/INSTALL.html) for pyomo even though everything seemed to install:
sudo apt-get install gcc g++ gfortran git patch wget pkg-config liblapack-dev libmetis-dev
Next, I attempted to use coinbrew following coin-or repo's suggestion:
/path/to/coinbrew fetch Ipopt --no-prompt
/path/to/coinbrew build Ipopt --prefix=/[COLOR=var(--highlight-literal)]dir[/COLOR]/to/install --test --no-prompt --verbosity=[COLOR=var(--highlight-namespace)]3[/COLOR]
/path/to/coinbrew install Ipopt --no-prompt
It took a long time to build from the source and I am not sure if this did anything.
My third attempt was installing cyipopt https://github.com/mechmotum/cyipoptdate with pip and running one of the examples there in their repo. That worked perfectly fine with using cyipot but not pyomo which still could not find the solver when I tried to run it. On my fourth attempt, I went ahead and downloaded the ipopt linux64 directly from https://ampl.com/dl/open/ipopt/llcsupplies. I then unzipped the file and copied the executable ipopt into my /usr/bin and then added +x permission to it. I tested out the executable by ./ipopt and it appears to work properly there:
$ 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}
I went ahead and ran it on an example file:
[COLOR=var(--highlight-keyword)]from[/COLOR] pyomo.environ [COLOR=var(--highlight-keyword)]import[/COLOR] *

V = [COLOR=var(--highlight-namespace)]40[/COLOR] [COLOR=var(--highlight-comment)]# liters[/COLOR]
kA = [COLOR=var(--highlight-namespace)]0.5[/COLOR] [COLOR=var(--highlight-comment)]# 1/min[/COLOR]
kB = [COLOR=var(--highlight-namespace)]0.1[/COLOR] [COLOR=var(--highlight-comment)]# l/min[/COLOR]
CAf = [COLOR=var(--highlight-namespace)]2.0[/COLOR] [COLOR=var(--highlight-comment)]# moles/liter[/COLOR]

[COLOR=var(--highlight-comment)]# create a model instance[/COLOR]
m = ConcreteModel()

[COLOR=var(--highlight-comment)]# create the decision variable[/COLOR]
m.q = Var(domain=NonNegativeReals)

[COLOR=var(--highlight-comment)]# create the objective[/COLOR]
m.CBmax = Objective(expr=m.q*V*kA*CAf/(m.q + V*kB)/(m.q + V*kA), sense=maximize)

[COLOR=var(--highlight-comment)]# solve using the nonlinear solver ipopt[/COLOR]
SolverFactory([COLOR=var(--highlight-variable)]'ipopt'[/COLOR]).solve(m)

[COLOR=var(--highlight-comment)]# print solution[/COLOR]
[COLOR=var(--highlight-literal)]print[/COLOR]([COLOR=var(--highlight-variable)]'Flowrate at maximum CB = '[/COLOR], m.q(), [COLOR=var(--highlight-variable)]'liters per minute.'[/COLOR])
[COLOR=var(--highlight-literal)]print[/COLOR]([COLOR=var(--highlight-variable)]'Maximum CB ='[/COLOR], m.CBmax(), [COLOR=var(--highlight-variable)]'moles per liter.'[/COLOR])
[COLOR=var(--highlight-literal)]print[/COLOR]([COLOR=var(--highlight-variable)]'Productivity = '[/COLOR], m.q()*m.CBmax(), [COLOR=var(--highlight-variable)]'moles per minute.'[/COLOR])
The error is:
WARNING: Could [COLOR=var(--highlight-keyword)]not[/COLOR] locate the [COLOR=var(--highlight-variable)]'ipopt'[/COLOR] executable, which [COLOR=var(--highlight-keyword)]is[/COLOR] required [COLOR=var(--highlight-keyword)]for[/COLOR] solver
ipopt
Traceback (most recent call last):
File [COLOR=var(--highlight-variable)]"/media/sf_SharedFiles/Code/optimization/examplescalaroptimize.py"[/COLOR], line [COLOR=var(--highlight-namespace)]20[/COLOR], [COLOR=var(--highlight-keyword)]in[/COLOR] <module>
SolverFactory([COLOR=var(--highlight-variable)]'ipopt'[/COLOR]).solve(m)
File [COLOR=var(--highlight-variable)]"/home/kali/.local/lib/python3.9/site-packages/pyomo/opt/base/solvers.py"[/COLOR], line [COLOR=var(--highlight-namespace)]512[/COLOR], [COLOR=var(--highlight-keyword)]in[/COLOR] solve
self.available(exception_flag=[COLOR=var(--highlight-literal)]True[/COLOR])
File [COLOR=var(--highlight-variable)]"/home/kali/.local/lib/python3.9/site-packages/pyomo/opt/solver/shellcmd.py"[/COLOR], line [COLOR=var(--highlight-namespace)]128[/COLOR], [COLOR=var(--highlight-keyword)]in[/COLOR] available
[COLOR=var(--highlight-keyword)]raise[/COLOR] ApplicationError(msg % self.name)
pyomo.common.errors.ApplicationError: No executable found [COLOR=var(--highlight-keyword)]for[/COLOR] solver [COLOR=var(--highlight-variable)]'ipopt'[/COLOR]
I have spent several hours looking into this and nothing has worked.