0

I'm using Gurobi solver for a mathematical problem in Ubuntu. I have installed Gurobi through Anaconda and have successfully installed a license for it. However, I'm getting this error after a few minutes.

  File "Model22.py", line 704, in <module>
    results = solver_manager.solve(model)
  File "/home/urafiee/anaconda3/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 601, in solve
    result = self._postsolve()
  File "/home/urafiee/anaconda3/lib/python3.8/site-packages/pyomo/solvers/plugins/solvers/ASL.py", line 220, in _postsolve
    return SystemCallSolver._postsolve(self)
  File "/home/urafiee/anaconda3/lib/python3.8/site-packages/pyomo/opt/solver/shellcmd.py", line 277, in _postsolve
    results = self.process_output(self._rc)
  File "/home/urafiee/anaconda3/lib/python3.8/site-packages/pyomo/opt/solver/shellcmd.py", line 371, in process_output
    results = self._results_reader(self._results_file,
  File "/home/urafiee/anaconda3/lib/python3.8/site-packages/pyomo/opt/plugins/sol.py", line 42, in __call__
    with open(filename,"r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpsau52uq0.pyomo.sol'

It's noteworthy to say that this exact model is solved to optimality on a different system with Windows OS. I'd appreciate it if anybody could help.

Thanks,

AliRa
  • 51
  • 6
  • There is an [opened pyomo's issue](https://github.com/Pyomo/pyomo/issues/2132) discussing this problem. When you install `gurobi` from `pip` or `conda`, it does not come with `gurobi.sh`, which is needed by `pyomo`. Can you try [installing directly gurobi](https://www.gurobi.com/documentation/9.1/quickstart_linux/index.html)? Ca you try changing the `SolverFactory` to `solver=pyo.SolverFactory('gurobi_direct')` and check if it works? – pybegginer Nov 03 '21 at 23:58
  • @pybegginer I see, thanks. Does using gurobi_direct make a difference in any section? It works. I've also tried installing Gurobi directly, still, I face some issues I can't understand. – AliRa Nov 04 '21 at 15:15
  • 1
    It changes the way the model is handled and passed into solver. In the `gurobi` approach a `.lp` file is created and sent into the command line for solving. This approach generate a `.sol` file that is the solution results and is loaded back into model. Using the `gurobi_direct` wraps the model directly into the gurobi's Python API. – pybegginer Nov 04 '21 at 15:40

0 Answers0