-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Windows version of gams from WSL #3147
Comments
This may seem like a silly question, but are you importing all of
I get a warning:
|
I'm not doing that import, should it be done when using gams? I didn't have problems on Windows While debugging I replicated the command that's generated inside
|
Moving that tmp file to the Windows filesystem seems to make it solve correctly though |
Seems to be related to GAMS Windows executable not being able to read into WSL directories. Steps to make a dirty fix
SolverFactory('gams').solve(
model, solver='CPLEX',
tee=True,
add_options=['option reslim=30; option optcr = 0.0;'],
tmpdir="wsl.localhost/Ubuntu/mnt/d/tmpmodels",
keepfiles=True
)
! GAMS.py lines 677-695
def _run_simple_model(self, n):
solver_exec = self.executable()
if solver_exec is None:
return False
tmpdir = mkdtemp()
try:
test = os.path.join(tmpdir, 'test.gms')
with open(test, 'w') as FILE:
FILE.write(self._simple_model(n))
result = subprocess.run(
[solver_exec, test, "curdir=" + tmpdir, 'lo=0'],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
# This little hack:
return True
# return not result.returncode
finally:
shutil.rmtree(tmpdir)
return False |
@frankpiedra I'm glad it's working for you now. We are actively in the process of redesigning the solver interfaces (see #3137 and #1030 ). I'm going to add this to the very long list of "solver-related issues" on that PEP issue. |
Summary
I want to use
gams
as a solver with: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 thoughSteps to reproduce the issue
Error Message
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
The text was updated successfully, but these errors were encountered: