I tried to run a simple code using ipopt in my anaconda after succesfully installation of Coopr, pyomo, glpk and ipopt in my new environment with two different versions of python, 3.9 and 3.11:
#SolverFactory('glpk').solve(model).write()
SolverFactory('ipopt').solve(model).write()
WHEN I use glpk just as above, it is wonderful, the optimal solution comes and beautiful graphs are shown. But when I use ipopt just as above, then it comes the nightmare:
The error was:
WARNING: Could not locate the 'ipopt' executable, which is required for solver
ipopt
Traceback (most recent call last):
File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)
File c:\users\acbba\anaconda3\envs\pyomo_projects_optimization\scripts\ifac_paper_nlp_fpso_2024.py:1711
SolverFactory('ipopt').solve(model).write()
File ~\anaconda3\Lib\site-packages\pyomo\opt\base\solvers.py:533 in solve
self.available(exception_flag=True)
File ~\anaconda3\Lib\site-packages\pyomo\opt\solver\shellcmd.py:141 in available
raise ApplicationError(msg % self.name)
ApplicationError: No executable found for solver 'ipopt'
What should I do? I was working in the Spyder and also in the Jupyter, but the error remains. I have saw plenty of videos in the youtube people using just like this, but it is not working.
Tip: even downloading ipopt in my conda env, I also downloaded ipopt.exe and put it in the PATH in the address C:\ipopt\bin.
I also tried the following line of code:
SolverFactory('ipopt', executable= 'C:\Users\acbba\anaconda3\envs\PYOMO_PROJECTS_OPTIMIZATION\ipopt.exe').solve(model).write()
But it still gives an error:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape