Using Pyomo and ipopt with Streamlit cloud app

Hi all, first post here. I’m messing around with quadratic optimization in Pyomo to find the optimal schedule for a PV/battery combination.

On my local Windows machine, installation worked fine. I downloaded the ipopt folder from here, added the path to the ipopt executable to PATH, and was able to call

import pyomo.environ as pyo
opt = pyo.SolverFactory('ipopt')
model = pyo.ConcreteModel()

... some optimization logic...

result = opt.solve(model)

I have been trying to get the ipopt solver running on Streamlit Cloud. I am not at all experienced with dependency management, but I have tried a lot of things without any success.

First attempt:
Online I found that one needs to put

coinor-libipopt-dev

into packages.txt, in addition with the other dependencies in requirements.txt. This did not yield any success…

Second attempt:
putting the ipopt executable in the repo and using the executable_path parameter in SolverFactory, as such:

# 
opt = pyo.SolverFactory('ipopt',executable='ipopt')

This works fine on my local machine, but this executable (together with the linux executable file I put in the repo) is not found when deploying to Streamlit Cloud:

  /home/adminuser/venv/lib/python3.12/site-packages/pyomo/opt/solver/shellcmd.  
  py:140 in available                                                           
    137 │   │   if ans is None:                                                 
    138 │   │   │   if exception_flag:                                          
    139 │   │   │   │   msg = "No executable found for solver '%s'"             
  ❱ 140 │   │   │   │   raise ApplicationError(msg % self.name)                 
    141 │   │   │   return False                                                
    142 │   │   return True                                                     
    143                                                                         
────────────────────────────────────────────────────────────────────────────────
ApplicationError: No executable found for solver 'ipopt'

Neither attempt works. I would strongly prefer to not depend on a manually-placed executable, also as I don’t want it to seem like I’m taking credit for it. Could someone help me out with a combination of packages.txt and requirements.txt that would solve it?

You can find the repo here: GitHub - daan-gieles/colocation_battery_optimization

Thanks in advance!