Skip to content

Using Windows version of gams from WSL #3147

Open
@frankpiedra

Description

Summary

I want to use gams as a solver with:

solver = SolverFactory('gams')

The problem is that I work from a Windows machine using WSL for the python-side, but gams is installed on the Windows-side.
pyomo doesn't seems capable of finding gams executable, even when adding gams folder to my PATH or symlinking it to my ~/.local/bin folder. I can run gams from the WSL terminal with no problem though

Steps to reproduce the issue

from pyomo.opt import SolverFactory
solver = SolverFactory('gams')
solver.available()

Error Message

NameError                                 Traceback (most recent call last)
Cell In[32], [line 1](vscode-notebook-cell:?execution_count=32&line=1)
----> [1](vscode-notebook-cell:?execution_count=32&line=1) solver.available()

File [~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:667](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:667), in GAMSShell.available(self, exception_flag)
    [665](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:665) avail = self._run_simple_model(1)
    [666](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:666) if not avail and exception_flag:
--> [667](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:667)     raise NameError(
    [668](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:668)         "'gams' command failed to solve a simple model - "
    [669](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:669)         "GAMS shell solver functionality is not available."
    [670](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:670)     )
    [671](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/mnt/d/Papers_propios/Paper3/Pyomo_Code_Debug/~/.virtualenvs/forest_problem/lib/python3.10/site-packages/pyomo/solvers/plugins/solvers/GAMS.py:671) return avail

NameError: 'gams' command failed to solve a simple model - GAMS shell solver functionality is not available.

Information on your system

Pyomo version:6.7.0
Python version:3.10.12
Operating system: Windows 10 with Ubuntu WSL
How Pyomo was installed (PyPI, conda, source): PyPI
Solver (if applicable): gams CPLEX

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions